Changes by Martin Panter :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> subprocess.Popen(cwd) documentation
___
Python tracker
Jovik added the comment:
I appreciate your suggestion regarding cygwin, but in the new code base we want
to avoid this dependency. Thanks for your time on this issue.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20927
Jovik added the comment:
Isn't Python's crossplatform functionality a key feature? A quick fix would be
to retry the call by adding cwd to arg[0] in case of FileNotFoundError.
--
___
Python tracker rep...@bugs.python.org
Eric V. Smith added the comment:
We don't always provide fully cross-platform functionality (see the os module
for many examples), but we might be able to do better here. It might be some
functionality we can add, it might be a documentation issue.
Note, for example, the
Jovik added the comment:
As requested I did extra tests with extension. Same result as before:
proc = subprocess.Popen(plink.exe, stdout=subprocess.PIPE,
cwd=c:\\python33\\workspace)
proc = subprocess.Popen(.\plink.exe, stdout=subprocess.PIPE,
cwd=c:\\python33\\workspace)
proc =
Eric V. Smith added the comment:
Where is plink.exe? If it's not in cwd (c:\python33\workspace), note that the
documentation for cwd says:
If cwd is not None, the function changes the working directory to cwd before
executing the child. In particular, the function looks for executable (or for
Jovik added the comment:
plink.exe is located in c:\python33\workspace. I'm aware of the docstring
difference between Python 2 and 3, thus submitted the bug for Python 3 only.
--
___
Python tracker rep...@bugs.python.org
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.
Jovik added the comment:
Why this feature works on Posix systems, but not Windows? If my memory is
correct, it didn't work anywhere when I used Python 2.7 (according with docs).
--
___
Python tracker rep...@bugs.python.org
Eric V. Smith added the comment:
The underlying APIs are very different. It's debatable how much of a shim we
should provide to make all platforms look alike.
I think first we should understand what it currently takes to make something
work in both environments. Then we can talk about how or
Jovik added the comment:
I'm quite aware of the os.sep issues between the systems, but I checked both
out of curiosity. Here are latest results:
All of the following commands raises the same exception:
proc = subprocess.Popen(plink, stdout=subprocess.PIPE,
cwd=c:\\python33\\workspace)
proc
Eric V. Smith added the comment:
In the first example, you switch from ./app to app.exe when using
shell=True.
What happens to any of your examples if you add .exe without shell=True?
Popen eventually calls CreateProcess on Windows. From:
Eric V. Smith added the comment:
Assuming this is the problem, we should at least document this. It does make
cross-platform coding difficult.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20927
Changes by Kathleen Weaver kathl...@kweaver.org:
--
nosy: +kathweaver
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20927
___
___
Python-bugs-list
New submission from Jovik:
This works on Linux as expected:
import subprocess
proc = subprocess.Popen([./app], stdout=subprocess.PIPE, cwd=workspace)
but on Windows I get:
FileNotFoundError: [WinError 2] The system cannot find the file specified
To successfully execute it on Windows I need to
R. David Murray added the comment:
Your cwd is relative. What happens if you make it absolute? (What I'm
thinking is that the non-shell starting cwd may be different on windows than it
is on unix...but I don't know windows very well, so this may be irrelevant...)
--
nosy:
Changes by Eric V. Smith e...@trueblade.com:
--
nosy: +eric.smith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20927
___
___
Python-bugs-list
Jovik added the comment:
I did a test with cwd being set to full path, but the result was the same
(still had to use shell=True to execute a command). Let me know if I can
provide any more details.
--
___
Python tracker rep...@bugs.python.org
Terry J. Reedy added the comment:
I am sure that using / instead of \, which is to say, not using os.sep, is the
problem as / is *not* allowed in Windows command names even though the
substitution works for paths given as options. In a Windows console,
python # works
.\python # works
19 matches
Mail list logo