redirecting stderr back..

Christian Heimes lists at cheimes.de
Fri Jan 9 23:38:41 CET 2009


rh0dium schrieb:
> Hi All,
> 
> Can someone tell me how to redirect stderr back to the console once
> you've moved it?

sys.stderr = sys.__stderr__

or better:

orig_stderr = sys.stderr
try:
    sys.stderr = open(...)
    ...
finally:
    sys.stderr = orig_stderr

Christian




More information about the Python-list mailing list