Bug in sys.stdout.flush()?

Fernando Pérez fperez528 at yahoo.com
Thu Nov 22 16:28:07 EST 2001


I have the following problem (Py2.1, Linux). I can't seem to flush stdout, 
only calling an explicit 'print' seems to work.

The following code (part of something bigger, so trust me :) doesn't work 
unless the print line is called:

sys.stdout.write(self.output_sep2)
sys.stdout.flush()
print ' out2,',self.output_sep2

If print isn't called, the value of self.output_sep2 is never printed. My 
problem is that I can't use print because of the extra space it always adds 
even for  a blank string.

So I'm stuck: print puts an extra space, and sys.stdout doesn't flush 
properly!

Any ideas?

Cheers,

f.



More information about the Python-list mailing list