New issue 2317: pypy3 subprocess.Popen failing with [WinError 0] rather than
[WinError 2]
https://bitbucket.org/pypy/pypy/issues/2317/pypy3-subprocesspopen-failing-with
peterjc:
There is a problem in pypy3-2.4.0 using subprocess when the command does not
exist on the `$PATH`, which ought to trigger ``[WinError 2] The system cannot
find the file specified`` but instead gives ``[Error 0] The operation completed
successfully`` and an additional exception trying to close a non-existent file
handle.
Testing on Windows XP (yes, I know its old):
```
c:\pypy3-2.4.0-win32\pypy -c "import subprocess; child =
subprocess.Popen('doesnotexist.exe --help', stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True,
shell=False)"
Traceback (most recent call last):
File "c:\pypy3-2.4.0-win32\lib-python\3\subprocess.py", line 744, in __init__
restore_signals, start_new_session)
File "c:\pypy3-2.4.0-win32\lib-python\3\subprocess.py", line 981, in _execute_
child
startupinfo)
File "c:\pypy3-2.4.0-win32\lib_pypy\_subprocess.py", line 166, in CreateProces
s
raise _WinError()
WindowsError: [Error 0] The operation completed successfully
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\pypy3-2.4.0-win32\lib-python\3\subprocess.py", line 763, in __init__
os.close(fd)
TypeError: __int__ returned non-int (type 'NoneType')
```
For comparison, the expected behaviour would be:
```
c:\python33\python -c "import subprocess; child =
subprocess.Popen('doesnotexist.exe --help', stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True,
shell=False)"
Traceback (most recent call last):
File "c:\python33\lib\subprocess.py", line 1090, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python33\lib\subprocess.py", line 818, in __init__
restore_signals, start_new_session)
File "c:\python33\lib\subprocess.py", line 1096, in _execute_child
raise WindowsError(*e.args)
FileNotFoundError: [WinError 2] The system cannot find the file specified
```
Or:
```
c:\python34\python -c "import subprocess; child =
subprocess.Popen('doesnotexist.exe --help', stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True,
shell=False)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python34\lib\subprocess.py", line 848, in __init__
restore_signals, start_new_session)
File "c:\python34\lib\subprocess.py", line 1104, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
```
Also working:
```
c:\pypy-5.0.1-win32\pypy -c "import subprocess; child =
subprocess.Popen('doesnotexist.exe --help', stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True,
shell=False)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\pypy-5.0.1-win32\lib-python\2.7\subprocess.py", line 725, in __init__
errread, errwrite)
File "c:\pypy-5.0.1-win32\lib-python\2.7\subprocess.py", line 977, in _execute
_child
startupinfo)
File "c:\pypy-5.0.1-win32\lib_pypy\_subprocess.py", line 165, in CreateProcess
raise _WinError()
WindowsError: [Error 2] The system cannot find the file specified
```
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue