A
arve.knudsen
Hi
Since upgrading to Python 2.7, I've run into the problem that when I
launch shell scripts (.e.g, *.bat) via subprocess.Popen (with False
for the 'shell' option, mind you), the arguments get interpreted by
the shell. For instance, the '|' character, no longer gets passed
verbatim to the script. What is now the correct way to protect
arguments passed as a list to subprocess.Popen? I tried enclosing each
argument in double quotes, but subprocess in turn thwarts my attempt,
by protecting each double quote with a backslash! For example, if I
were to pass ['"|"'] as the argument list to subprocess.Popen, it'd be
transformed like this:
Thanks,
Arve
Since upgrading to Python 2.7, I've run into the problem that when I
launch shell scripts (.e.g, *.bat) via subprocess.Popen (with False
for the 'shell' option, mind you), the arguments get interpreted by
the shell. For instance, the '|' character, no longer gets passed
verbatim to the script. What is now the correct way to protect
arguments passed as a list to subprocess.Popen? I tried enclosing each
argument in double quotes, but subprocess in turn thwarts my attempt,
by protecting each double quote with a backslash! For example, if I
were to pass ['"|"'] as the argument list to subprocess.Popen, it'd be
transformed like this:
'\\"|\\"'subprocess.list2cmdline(['"|"'])
Thanks,
Arve