The documentation for subprocess.Popen says:
"""
args should be a string, or a sequence of program
arguments. The program to execute is normally the first
item in the args sequence or string, but can be
explicitly set by using the executable argument.
"""
and
"""
If cwd is not None, the current directory will be
changed to cwd before the child is executed.
"""
However if you set the cwd parameter and in args[0]
specify a relative path to an executable from the cwd
directory it doesn't work. To get it to work you have
to make args[0] use a relative path from the current
directory of the python process, not the directory you
specify in the cwd parameter.
Possibly this is the intended behaviour, in which case
the documentation is lacking by omitting this fact. Or
maybe this isn't the intended behaviour in which case
it's a bug in the code.
I've not tested this on any platform other than Windows
so don't know if this is consistent across platforms.
|