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 set shell=True first:
proc = subprocess.Popen(["app.exe"], stdout=subprocess.PIPE, cwd="workspace", 
shell=True)

which is odd since by default it should use cwd when searching for binary:
"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 
the first item in args) relative to cwd if the executable path is a relative 
path."
from http://docs.python.org/3.3/library/subprocess.html

----------
assignee: docs@python
components: Documentation
messages: 213570
nosy: Jovik, docs@python
priority: normal
severity: normal
status: open
title: Different behaviour on Posix and Windows when using 
subprocess.Popen(..., cwd=path)
type: behavior
versions: Python 3.3

_______________________________________
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