Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython in unbuffered mode

Tags:

python

ipython

Is there a way to run IPython in unbuffered mode?

The same way as python -u gives unbuffered IO for the standard python shell

like image 412
pufferfish Avatar asked Nov 06 '22 19:11

pufferfish


1 Answers

From Python's man page:

   -u     Force stdin, stdout and stderr to be totally unbuffered.  On systems
          where it matters, also put stdin, stdout and stderr in binary mode.
          Note that there is internal buffering in xreadlines(), readlines()
          and file-object iterators ("for line in sys.stdin") which is not
          influenced by this option.  To work around this, you will want to use
          "sys.stdin.readline()" inside a "while 1:" loop.

If using unbuffered mode interferes with readline, it certainly would interfere even more with all the magic editing and auto-completion that iPython gives you. I'm inclined to suspect that's why that command line option isn't in iPython.

like image 141
Ken Kinder Avatar answered Nov 12 '22 17:11

Ken Kinder