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.