Author chris.jerdonek
Recipients asvetlov, chris.jerdonek, cvrebert, docs@python, ned.deily, python-dev
Date 2012-09-30.16:33:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1349022788.8.0.209925444879.issue15533@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-09-30 16:33:08chris.jerdoneksetrecipients: + chris.jerdonek, ned.deily, cvrebert, asvetlov, docs@python, python-dev
2012-09-30 16:33:08chris.jerdoneksetmessageid: <1349022788.8.0.209925444879.issue15533@psf.upfronthosting.co.za>
2012-09-30 16:33:08chris.jerdoneklinkissue15533 messages
2012-09-30 16:33:07chris.jerdonekcreate