Robert Kern schrieb: > Christian Heimes wrote: >> 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 > > He's not reassigning the sys.stderr object; he's fiddling with the > underlying file descriptor.
I know that. I wanted to show him a better way than messing around with file descriptors. In Python one doesn't have to (and should not) alter the file descriptor of a standard stream. Python always uses sys.stderr to write to the standard error stream. Christian -- http://mail.python.org/mailman/listinfo/python-list