Eric V. Smith added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20927>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to