Multi-threaded printing and IOErrors in Windows
Tim Peters
tim.one at comcast.net
Fri Apr 23 15:46:18 EDT 2004
[David Bolen]
> ...
> If that were the case, doing some test prints in your code of very
> long strings (the C buffer is probably anywhere from 2-8K) should
> be able to reproduce the problem more reliably.
stderr and stdout both "blow up" eventually on Windows is they're not
attached to something usable. Here's a little Python program:
"""
import sys
i = 0
while 1:
sys.stdout.write('x')
i += 1
f = open('count.txt', 'w')
print >> f, 'wrote', i, 'bytes'
f.flush()
f.close()
"""
If I run that from a console with pythonw.exe, it soon dies, and count.txt
is left containing "wrote 4096 bytes". Same thing if I use sys.stderr.
More information about the Python-list
mailing list