Random832 <random...@fastmail.com> wrote: >The opposite of line buffering is not no buffering, but full >(i.e. block) buffering, that doesn't get flushed until it runs >out of space. TextIOWrapper has its own internal buffer, and its >design apparently doesn't contemplate the possibility of using >it with a raw FileIO object (which may mean that the posted code >isn't guaranteed to work) or disabling buffering.
Hmmm. That even seems to cause trouble for sys.stderr.write (in Python3 with a non-tty e.g. a piped output): $ python2 -c 'import sys;sys.stderr.write("1\n");print("2")' 2>&1 | tee 1 2 $ python3 -c 'import sys;sys.stderr.write("1\n");print("2")' 2>&1 | tee 2 1 -- https://mail.python.org/mailman/listinfo/python-list