It's surprising and broken that stderr should be buffered in python3. python3
calls setvbuf(3) on stderr at startup to achieve this chuckle-headed behavior.
It makes stderr line buffered if on a terminal, and fully buffered if
redirected to a log file. A fully buffered stderr is a very bad
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
which unfortunately doesn't work! I guess will resort to python3 -u, although
I don't want stdout to be unbuffered.
--
https://mail.python.org/mailman/listinfo/python-list
Hi Terry,
The difference from 2.x should be in What's New in 3.0, except that the
new i/o module is in 2.6, so it was not exactly new.
The io module existed in 2.6, but it was not used by default for
standard output and standard error. The only mention of this in
What's New in 3.0 is in the
Hi all,
Short version:
I'm a bit confused in general as to the changes between python2 and
python3 regarding how standard output and standard error do buffering.
A few things seem to have changed and I've failed to find any
documentation of how and why. Also, the meaning of python -u seems
to
On 12/9/2011 2:32 PM, Geoff Bache wrote:
Hi all,
Short version:
I'm a bit confused in general as to the changes between python2 and
python3 regarding how standard output and standard error do buffering.
A few things seem to have changed and I've failed to find any
documentation of how and why.