This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author CrouZ
Recipients CrouZ
Date 2011-06-19.11:54:27
SpamBayes Score 0.0019547471
Marked as misclassified No
Message-id <1308484469.07.0.183679087602.issue12362@psf.upfronthosting.co.za>
In-reply-to
Content
Steps to repeat:
* Create the script foo.py consisting of the line: print("foo")
* Run: foo.py > bar

Behavior:
 2.7.2: The file bar is created but empty. Prints the following message on exit:

close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

 3.1.4: The file bar is created but empty. No printouts indicating that something went wrong.

Expected behavior:
 All: The file bar has the content foo.

Additional information:
 sys.stdout, and probably also sys.stderr, do not appear to be set up properly.
  2.7.2: stdout is set to a file but performing any operations on it throws the exception: IOError: [Errno 9] Bad file descriptor
  3.1.4: stdout is set to None

Workaround:
 All: python foo.py > bar

Used software:
 Windows 7 Ultimate SP1 x64 (6.1.7601)
 Python 2.7.2 and 3.1.4 installed with the msi-installer including Registering Extensions.
History
Date User Action Args
2011-06-19 11:54:29CrouZsetrecipients: + CrouZ
2011-06-19 11:54:29CrouZsetmessageid: <1308484469.07.0.183679087602.issue12362@psf.upfronthosting.co.za>
2011-06-19 11:54:28CrouZlinkissue12362 messages
2011-06-19 11:54:27CrouZcreate