[ python-Bugs-1710802 ] subprocess must escape redirection characters under win32
SourceForge.net
noreply at sourceforge.net
Tue May 1 22:46:25 CEST 2007
Bugs item #1710802, was opened at 2007-05-01 22:46
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=1710802&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Patrick Mézard (pmezard)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess must escape redirection characters under win32
Initial Comment:
Hello,
For some reason, subprocess.Popen arguments are not processed correctly when one of them contains a redirection character ("<>&|") when calling a batch file.
Unittest and patch are attached below. Here are the steps to reproduce it:
callee.py
"""
import sys
print sys.argv
"""
callee.bat
"""
python callee.py %*
"""
caller.py
"""
import subprocess
args = [
'a<b',
'a>b',
'a|b',
'a&b',
]
for arg in args:
subprocess.check_call(['callee.bat', arg])
"""
Then:
"""
>python caller.py
The system cannot find the file specified.
Traceback (most recent call last):
File "caller.py", line 22, in <module>
subprocess.check_call(['callee.bat', arg])
File "C:\Python251\lib\subprocess.py", line 461, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['callee.bat', 'a<b']' returned non-zero
exit status 1
"""
With:
"""
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
"""
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1710802&group_id=5470
More information about the Python-bugs-list
mailing list