Enthought Canopy doesn't print right away when statement occurs

后端 未结 2 970
我寻月下人不归
我寻月下人不归 2020-12-19 21:48

A while ago I switched from Enthought\'s old EPD to their newer Canopy system. For the most part it\'s nice, but one aspect has been particularly vexing.

Whenever

相关标签:
2条回答
  • 2020-12-19 22:25

    No, this is not a change between EPD and Canopy. While I suppose there might be some python distributions which default to buffering off, EPD was not one of them -- the performance hit could have been too severe (as kindall's comment mentions.) Better to let the programmer decide when it's important for the user to see console output immediately (typically for status updates).

    BTW, IPython in the Canopy GUI is simply IPython QtConsole. If you are depending on console I/O, you may also need to be aware of this longstanding issue with QtConsole:

    I don't think there's a reasonable workaround for Canopy IPython, other than do it "properly", i.e. with flush.

    https://support.enthought.com/entries/22157050-Canopy-Python-prompt-QtConsole-Can-t-run-interactive-OS-shell-commands

    0 讨论(0)
  • 2020-12-19 22:35

    This looks like buffered output. Try running your script as:

    python -u yourscript
    

    The -u flag turns buffering off.

    (Replace python by your OS's python executable's name.)

    0 讨论(0)
提交回复
热议问题