[docs] [issue15533] subprocess.Popen(cwd) documentation
Chris Jerdonek
report at bugs.python.org
Sun Sep 30 18:33:08 CEST 2012
Chris Jerdonek added the comment:
So it seems the cwd argument to Popen() currently works differently on Windows from Mac OS X. For example, the following doesn't work on Windows (but does on Mac). Windows doesn't look for arg0 relative to arg_cwd:
def test_cwd(arg0, arg_cwd):
os.chdir('foo') # Make sure we're in a different directory from arg0.
p = subprocess.Popen([arg0, "-c",
"import os, sys; "
"sys.stdout.write(os.getcwd()); "
"sys.exit(47)"],
stdout=subprocess.PIPE,
cwd=arg_cwd)
p.wait()
print("stdout: " + p.stdout.read().decode("utf-8"))
print("return_code: %s" % p.returncode)
python_path = os.path.realpath(sys.executable)
python_dir, python_base = os.path.split(python_path)
rel_python = os.path.join(os.curdir, python_base)
# Raises: WindowsError: [Error 2] The system cannot find the file specified
test_cwd(rel_python, python_dir)
I'm going to mark the two tests as "skipped" on Windows pending a resolution.
----------
keywords: -easy
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15533>
_______________________________________
More information about the docs
mailing list