Bugs item #1358527, was opened at 2005-11-16 22:59 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1358527&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: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Martin Blais (blais) Assigned to: Nobody/Anonymous (nobody) Summary: subprocess.py fails on Windows when there is no console Initial Comment: Under Windows XP, using Python 2.4.2, calling a subprocess from "subprocess.py" from a script that does not have a console, with stdin=None (the default) fails. Since there is a check for stdin=stdout=stderr=None that just returns, to exhibit this problem you need to at least set stdout=PIPE (just to get it to run past the check for that special case). The problem is that in _get_handles(), l581-582: if stdin == None: p2cread = GetStdHandle(STD_INPUT_HANDLE) GetStdHandle returns None if there is no console. This is rather nasty bugger of a bug, since I suppose it breaks most GUI applications that start without the console (i.e. most) and that eventually invoke subprocesses and capture their output. I'm surprised to find this. To reproduce the problem, do this: 1. save the attached script to C:/temp/bug.py and C:/temp/bug.pyw 2. create two shortcuts on your desktop to invoke those scripts 3. open a shell and tail C:/temp/out.log For bug.py, the log file should display: 2005-11-16 17:38:11,661 INFO 0 For bug.pyw (no console), the log file should show the following exception: 2005-11-16 17:38:13,084 ERROR Traceback (most recent call last): File "C:\Temp\bug.pyw", line 20, in ? out = call(['C:/Cygwin/bin/ls.exe'], stdout=PIPE) #, stderr=PIPE) File "C:\Python24\lib\subprocess.py", line 412, in call return Popen(*args, **kwargs).wait() 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 This is the bug. Note: in this test program, I'm invoking Cygwin's ls.exe. Feel free to change it ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1358527&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com