[New-bugs-announce] [issue12362] General Windows stdout redirection not working

CrouZ report at bugs.python.org
Sun Jun 19 13:54:29 CEST 2011


New submission from CrouZ <alfred.theorin at gmail.com>:

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.

----------
components: Windows
messages: 138626
nosy: CrouZ
priority: normal
severity: normal
status: open
title: General Windows stdout redirection not working
type: crash
versions: Python 2.7, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12362>
_______________________________________


More information about the New-bugs-announce mailing list