[IPython-user] some behaviour breaking IPython?

Max Bane max.bane@gmail....
Wed Apr 29 16:53:36 CDT 2009


On Wed, Apr 29, 2009 at 4:47 PM, David Warde-Farley <dwf@cs.toronto.edu> wrote:
> #1) When I've got a script running that plots every once in a while
> but prints constantly, the printing doesn't happen immediately, but
> seems lagged and chunked. So, I won't see anything for a while but
> then I'll see a huge chunk of buffered prints come at me all at once.
> Plots still seem to happen on schedule.

Not sure about problem #2, but problem #1 can probably be remedied by
flushing sys.stdout after every print statement. Something like:

print 'hello world'
sys.stdout.flush()

Or define a convenience function:

def fprint(msg):
  sys.stdout.write(msg + '\n')
  sys.stdout.flush()

and just use that instead of print.

-- 
Max Bane
PhD Student, Linguistics
University of Chicago
bane@uchicago.edu


More information about the IPython-user mailing list