Bugs item #1714451, was opened at 2007-05-07 17:13
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=1714451&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: Windows
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: tzellman (tzellman)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess.py problems errors when calling cmd.exe
Initial Comment:
An example:
>>> import subprocess
>>> proc = subprocess.Popen('"c:\Windows\system\ping.exe" "localhost"',
>>> shell=1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
'c:\Windows\system32\ping.exe" "localhost' is not recognized as an internal or
external command, operable program or batch file.
This normally works from the cmd.exe prompt, so the command line is being
passed incorrectly in the subprocess module.
My ACTUAL use case arises when I want to call the Microsoft compiler (CL.exe),
and add include directories that have spaces in the name. For example:
"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\CL.exe" /TC /O2 /DNDEBUG /W3
/nologo /c /EHsc /errorReport:prompt /Idefault\ /I.. /I. /Idefault
/I"C:\Program Files\GnuWin32" /DWIN32 ..\pcreposix.c /Fodefault\pcreposix.obj
The fix for this problem is to modify line 765 in subprocess.py, replacing it
with:
args = comspec + " /s /c \"%s\"" % args.replace('""', '"')
The /s tells cmd.exe not to re-format the command line. We then encase the
entire command line in double quotes. I also replace occurrences of "" with "
in the arg string, in case the user already encased the command in double
quotes.
With this fix, the commands execute correctly.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1714451&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com