Patches item #1603907, was opened at 2006-11-27 12:20
Message generated for change (Settings changed) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1603907&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Oren Tirosh (orenti)
>Assigned to: Peter Åstrand (astrand)
Summary: subprocess: error redirecting i/o from non-console process
Initial Comment:
In IDLE, PythonWin or other non-console interactive Python under Windows:
>>> from subprocess import *
>>> Popen('cmd', stdout=PIPE)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in -toplevel-
Popen('', stdout=PIPE)
File "C:\python24\lib\subprocess.py", line 533, in __init__
(p2cread, p2cwrite,
File "C:\python24\lib\subprocess.py", line 593, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\python24\lib\subprocess.py", line 634, in _make_inheritable
DUPLICATE_SAME_ACCESS)
TypeError: an integer is required
The same command in a console windows is successful.
Why it happens:
subprocess assumes that GetStdHandle always succeeds but when there is no
console it returns None. DuplicateHandle then complains about getting a
non-integer. This problem does not happen when redirecting all three standard
handles.
Solution:
Replace None with -1 (INVALID_HANDLE_VALUE) in _make_inheritable.
Patch attached.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1603907&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches