catch output of threads

Martin v. Löwis martin at v.loewis.de
Fri Nov 29 15:46:05 EST 2002


William <wilk-spamout at flibuste.net> writes:

> Is it possible to catch the output from print of differents threads ?
> In a single thread, i can change the value of sys.stdout... but with
> differents thread i don't know ?

You can still change the value of sys.stdout, even for multiple
threads. The print statement internally uses sys.stdout itself.

If multiple threads interleave print statements, you will get mixed
output on your replaced sys.stdout, just as you would with the
standard sys.stdout.

HTH,
Martin



More information about the Python-list mailing list