Author eric.smith
Recipients Jovik, docs@python, eric.smith, kathweaver, r.david.murray, terry.reedy
Date 2014-03-17.14:06:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395065183.54.0.241050156619.issue20927@psf.upfronthosting.co.za>
In-reply-to
Content
I think the 2.7 documentation is correct: the current directory when the call is made, and not cwd, is included in the search path. I'd suggest specifying args as ["c:\\python33\\workspace\\plink.exe"].

I think I may have mislead you earlier on the search path. The Windows call is:
CreateProcess(lpApplicationName, lpCommandLine, <other stuff>, lpCurrentDirectory, <other stuff>)

The first parameter to Popen ("args") becomes lpCommandLine. The "executable" parameter to Popen, which you're not setting, becomes lpApplicationName. So, you're calling CreateProcess(NULL, "plink.exe, ..., lpCurrentDirectory="c:\\python33\\workspace").

In this case, .exe would be added if missing. But, the search path rules seem to not include the directory pointed to by lpCurrentDirectory (aka cwd).

So I think this would work:
subprocess.Popen(["c:\\python33\\workspace\\plink.exe"], stdout=subprocess.PIPE, cwd="c:\\python33\\workspace")
or
subprocess.Popen(["plink"], executable="c:\\python33\\workspace\\plink.exe", stdout=subprocess.PIPE, cwd="c:\\python33\\workspace")

Unfortunately, I don't have a copy of 3.x on my Windows machine to test with.
History
Date User Action Args
2014-03-17 14:06:23eric.smithsetrecipients: + eric.smith, terry.reedy, r.david.murray, docs@python, Jovik, kathweaver
2014-03-17 14:06:23eric.smithsetmessageid: <1395065183.54.0.241050156619.issue20927@psf.upfronthosting.co.za>
2014-03-17 14:06:23eric.smithlinkissue20927 messages
2014-03-17 14:06:23eric.smithcreate