Multi-threaded printing and IOErrors in Windows
Thomas Heller
theller at python.net
Fri Apr 23 13:00:58 EDT 2004
"Roger Binns" <rogerb at rogerbinns.com> writes:
> David Fraser wrote:
>> sys.stdout is not threadsafe - try wrapping each call with a mutext and
>> see if that fixes it...
>
> Having to wrap hundreds of random print statements just using for
> debugging seems really silly. Note that I don't care if the
> output gets garbled. (It doesn't on Mac or Linux ever).
>
> And I am only hitting this problem on Windows when wrapped
> with py2exe. If running outside of py2exe there is never
> any problem.
>
> When using py2exe, the stdout doesn't go anywhere anyway
> (it is gui app not a console app).
>
> The bizarre thing is that the IOError is very infrequent,
> but very annoying when it happens.
If you have a small program which allows to reproduce this, I'll look
into it.
Thomas
More information about the Python-list
mailing list