This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.Popen + cwd + relative args[0]
Type: Stage:
Components: Windows Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, markshep
Priority: normal Keywords:

Created on 2006-05-10 10:10 by markshep, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg28471 - (view) Author: Mark Sheppard (markshep) Date: 2006-05-10 10:10
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.
msg28472 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-10 16:09
Logged In: YES 
user_id=849994

This is indeed intended behavior. "cwd" is the new current
directory for the child, not for the parent. I clarified
this in rev. 45950, 45951(2.4).
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43342
2006-05-10 10:10:06markshepcreate