Bugs item #1710802, was opened at 2007-05-01 13:46
Message generated for change (Comment added) made by nnorwitz
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: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Patrick Mézard (pmezard)
>Assigned to: Peter Åstrand (astrand)
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.
>>>
"""
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-05-01 23:38
Message:
Logged In: YES
user_id=33168
Originator: NO
Peter, can you take a look at this?
----------------------------------------------------------------------
Comment By: Patrick Mézard (pmezard)
Date: 2007-05-01 13:47
Message:
Logged In: YES
user_id=1660346
Originator: YES
File Added: fix_subp
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1710802&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com