New submission from Chris Jerdonek:
The sentence describing Popen()'s cwd argument in the subprocess documentation seems reversed to me:
It says, "If cwd is not None, the child’s current directory will be changed to cwd before it is executed. Note that this directory is not considered when searching the executable, so you can’t specify the program’s path relative to cwd."
However, when cwd is not None, it seems like you *must* specify the program's path relative to cwd. For example, when running a script containing the following using `./python.exe` from a source checkout--
p = Popen(['./python.exe', '-V'], stdout=PIPE, stderr=PIPE, cwd='temp')
you get an: "OSError: [Errno 2] No such file or directory."
In contrast, when you *do* specify the program's path relative to cwd, it works--
p = Popen(['../python.exe', '-V'], stdout=PIPE, stderr=PIPE, cwd='temp')
Issue 6374 seems to have made the same point in its second bullet, but the issue was closed without addressing that part of it.
---------- assignee: docs@python components: Documentation keywords: easy messages: 167194 nosy: cjerdonek, docs@python priority: normal severity: normal status: open title: subprocess.Popen(cwd) documentation versions: Python 2.7, Python 3.3