thread specific sys.stdout?
Peter Hansen
peter at engcorp.com
Wed Sep 15 17:19:04 EDT 2004
aurora wrote:
> This may sound a little crazy. I capture the output of one class by
> redirecting the sys.stdout. However the is another threading running at
> the same time and occasionaly it output some messages to the redirected
> sys.stdout irreleveant to the output I want to capture. Is there a way
> to redirect output specific to some threads?
I don't know if there's a simpler way, but we once wrote a
redirector which checked threading.currentThread() to determine
whether a particular .write() call should be redirected or
just passsed through to the original output via sys.__stdout__.
Sorry, I don't have access to the code any more, but it shouldn't
be hard for you to reproduce.
-Peter
More information about the Python-list
mailing list