homepage

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.

classification
Title: Windows STDIN/STDOUT Redirection is actually FIXED
Type: enhancement Stage: resolved
Components: Documentation, Installation, Windows Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, Nacsa.Kristóf, dhgmgn, docs@python, terry.reedy, tim.golden
Priority: normal Keywords: easy, patch

Created on 2012年09月18日 12:19 by Nacsa.Kristóf, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
15962.patch dhgmgn, 2012年11月02日 10:26 review
Messages (4)
msg170641 - (view) Author: Nacsa Kristóf (Nacsa.Kristóf) Date: 2012年09月18日 12:19
The Python docs faq says that due to a bug in Windows NT's cmd.exe, the output redirection and piping won't work when started from file extension.
http://docs.python.org/faq/windows.html#how-do-i-make-python-scripts-executable
http://docs.python.org/py3k/faq/windows.html#how-do-i-make-python-scripts-executable
This is actually fixed in Windows, but the fix is disabled by default, and you need to enable it in regedit, the keyword is "InheritConsoleHandles".
Proof & Details:
http://support.microsoft.com/default.aspx?kbid=321788
It would be great if the docs could refer to this fix, as the docs is the major source of information for many.
msg174499 - (view) Author: Jan Duzinkiewicz (dhgmgn) Date: 2012年11月02日 10:26
I've referenced the kb article in the docs. Please let me know if the fix is ok - maybe the whole registry change process should be included in the docs directly?
msg177575 - (view) Author: Nacsa Kristóf (Nacsa.Kristóf) Date: 2012年12月16日 00:38
@dhgmgn I think the change is ok. That said, I add two things. 
It maybe should be noted which Windows version has this corrected.
The article contains this string: "This problem was first corrected in Microsoft Windows 2000 Service Pack 4. This problem was first corrected in Windows XP Service Pack 1".
The other thing is that I prefer if the relevant information is copied due to various reasons. One reason is that it serves as a "highlight" (nice time-saver and is also against TL;DR situations). Another is that Microsoft may simply cease support, or discontinue this link (they tend to do this).
I'm not familiar with how the python docs is constructed, if there is a style guide, etc., but I can tell that I'd be happy if I could see this information there directly. This is also how I've found out about that cmd header line/'trick'.
@<everyone>
Another thing, can anyone else confirm that this works for [s]he?
I've tested this on an 32-bit xp pro sp3.
When _not_ using the fix, something like `foo | myscript.py | bar` results in:
 IOError: [Errno 9] Bad file descriptor
With _using_ the registry fix from Microsoft, the command from above just works for me on the XP. (The cmd.exe/console needs to be restarted.)
msg222920 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014年07月13日 12:17
This can be closed as "out of date" as extensive changes made to the Windows FAQ have removed the wording referenced in the patch.
History
Date User Action Args
2022年04月11日 14:57:36adminsetgithub: 60166
2014年07月13日 18:35:46terry.reedysetstatus: open -> closed
resolution: out of date
stage: needs patch -> resolved
2014年07月13日 13:23:38brian.curtinsetnosy: - brian.curtin
2014年07月13日 12:17:22BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222920
2012年12月16日 00:38:48Nacsa.Kristófsetmessages: + msg177575
2012年11月02日 10:26:10dhgmgnsetfiles: + 15962.patch

nosy: + dhgmgn
messages: + msg174499

keywords: + patch
2012年09月18日 12:23:33ezio.melottisetversions: - Python 2.6, Python 3.1
nosy: + terry.reedy, tim.golden, brian.curtin

keywords: + easy
type: enhancement
stage: needs patch
2012年09月18日 12:19:54Nacsa.Kristófcreate

AltStyle によって変換されたページ (->オリジナル) /