Python Forum

Full Version: Redirect to __stdout__ fails in IDLE shell
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
After redirecting to a file I can't return back.
I used sys.stdout = sys.__stdout__
but still no any output to shell window.
IDLE redirects stdout, so it is not using sys.__stdout__. You need to save a reference to IDLE's stdout before you redirect (oldstdout = sys.stdout) and restore to that when you are done.