[issue15962] Windows STDIN/STDOUT Redirection is actually FIXED
New submission from Nacsa Kristóf: 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-executa... http://docs.python.org/py3k/faq/windows.html#how-do-i-make-python-scripts-ex... 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. ---------- assignee: docs@python components: Documentation, Installation, Windows messages: 170641 nosy: Nacsa.Kristóf, docs@python priority: normal severity: normal status: open title: Windows STDIN/STDOUT Redirection is actually FIXED versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- keywords: +easy nosy: +brian.curtin, terry.reedy, tim.golden stage: -> needs patch type: -> enhancement versions: -Python 2.6, Python 3.1 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Jan Duzinkiewicz added the comment: 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? ---------- keywords: +patch nosy: +dhgmgn Added file: http://bugs.python.org/file27839/15962.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Nacsa Kristóf added the comment: @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.) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Mark Lawrence added the comment: This can be closed as "out of date" as extensive changes made to the Windows FAQ have removed the wording referenced in the patch. ---------- nosy: +BreamoreBoy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Changes by Brian Curtin <brian@python.org>: ---------- nosy: -brian.curtin _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
Changes by Terry J. Reedy <tjreedy@udel.edu>: ---------- resolution: -> out of date stage: needs patch -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15962> _______________________________________
participants (6)
-
Brian Curtin
-
Ezio Melotti
-
Jan Duzinkiewicz
-
Mark Lawrence
-
Nacsa Kristóf
-
Terry J. Reedy