[IPython-dev] output from script is delayed

Vasco Tenner vasco+python at tenner.nl
Thu Dec 12 09:12:46 EST 2013


Dear all,

I encountered that the output from a script run by %run -i is not 
directly displayed in the notebook.

When investigating I tested the following example:

import time
for i in range(10):
     print i
     time.sleep(2)

In this example 0 and 1 are displayed at the same time, after 4 seconds!

In the script I run the first sys.stdout.write call does not output 
anything, but after the second call both are displayed (the same for 3 
and 4 etc). This can partialy overcome by adding writing an empty string 
after each sys.stdout.write call:
sys.stdout.write('foo')
sys.stdout.write('')

However, still the first one is not displayed immediately.

Is this a flaw in the ipython notebook kernel/frontend communication or 
do I miss something?


Vasco Tenner



More information about the IPython-dev mailing list