Python Forum
Redirect to __stdout__ fails in IDLE shell
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect to __stdout__ fails in IDLE shell
#1
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.
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  redirect STDIO in the Python code Skaperen 6 1,220 Jul-05-2023, 12:23 AM
Last Post: Skaperen
  Launch Python IDLE Shell from terminal Pavel_47 5 1,143 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  What do i have to type in the IDLE shell to use this password manager program? MaartenRo 4 1,690 Jan-15-2022, 02:01 PM
Last Post: MaartenRo
  stderr redirect to file fmr300 2 3,488 Apr-03-2021, 01:31 AM
Last Post: fmr300
  Cannot redirect print to a file tester_V 3 2,452 Sep-11-2020, 12:21 AM
Last Post: tester_V
  redirect url_for passing arguments with the url Leon79 1 1,611 Jul-09-2020, 05:20 PM
Last Post: Leon79
  IDLE not importing pygame (ok outside of IDLE) miner_tom 1 3,279 Sep-14-2018, 07:54 PM
Last Post: Larz60+
  Redirect to file vndywarhol 1 2,272 Aug-23-2018, 11:01 AM
Last Post: DeaD_EyE
  Python redirect users to another url after form post blsturgeon 5 18,665 Jun-28-2018, 11:53 PM
Last Post: gontajones
  Script for media content and redirect in to a file puneet102 0 2,322 May-22-2018, 12:06 PM
Last Post: puneet102

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020