stdout custom

Tim Golden mail at timgolden.me.uk
Tue Mar 18 09:51:54 EDT 2008


castironpi at gmail.com wrote:
>>> Can I allocate a second console window, so I can place certain output
>>> to that directly, and leave the original streams alone?  

I've rather lost track of what you're trying to do, but I would
second Gabriel's suggestion of the standard Windows method of
debug output: using OutputDebugString. There's an example here:

http://timgolden.me.uk/python/win32_how_do_i/capture-OutputDebugString.html

and it shouldn't be too hard to wrap it in a file-like
object for stderr-substitution use, say.

Obviously there are 1,001 other ways of doing IPC but since this
one's ready-made you might as well use it. You can distinguish
between different processes' outputs by virtue of the PID which
is the first item on the mmap.

TJG



More information about the Python-list mailing list