[New-bugs-announce] [issue16892] Windows bug picking up stdin from a pipe
report at bugs.python.org
Tue Jan 8 14:44:24 CET 2013
New submission from Robert Oeffner:
This is a bug that seems to exist on python 2.7, python 3.3 on Windows versions XP, Vista, 7 and 8 and has been around for some years, presumably also in other python versions. It is only recently I have managed to better isolate it although not completely.
My Windows PC is set up with some doskey macros that are loaded at each
instance of the commandline interpreter cmd.exe with the registry key
Unfortunately this seems to delete stdin when stdin is piped to python scripts that runs another executable invoked with subprocess. In this case the command:
python32 testsubproc.py < mytextfile.txt
will not work. The textfile mytextfile.txt will be ignored. If subprocess is invoked with shell=False the textfile does get piped into stdin. This is however not an option as our porgrams are distributed on other platforms. It would also give an inconsistent experience on the same OS (Windows).
If mymacros.cmd is called interactively from the command prompt the problem does not exist and stdin can be piped into the python script with no problem.
I have attached a working script below which includes a comment section with a small C++ program and the registry key in question to demonstrate the problem.
I would be grateful if there are people who know how to get to the bottom of this bug or even fix it.
components: Build, Windows
title: Windows bug picking up stdin from a pipe
versions: Python 2.6, Python 2.7, Python 3.3
Added file: http://bugs.python.org/file28631/testsubproc.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce