Redirect to __stdout__ fails in IDLE shell - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Redirect to __stdout__ fails in IDLE shell (/thread-25837.html) |
Redirect to __stdout__ fails in IDLE shell - Pavel_47 - Apr-13-2020 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. RE: Redirect to __stdout__ fails in IDLE shell - deanhystad - Apr-13-2020 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. |