New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popen doesn't work on Windows when args is a list #76945
Comments
test_subprocess is failing on Windows. C:\py\cpython3.7>./python -m test -uall -v -m test_nonexisting_with_pipes test_subprocess ====================================================================== Traceback (most recent call last):
File "C:\py\cpython3.7\lib\test\test_subprocess.py", line 1194, in test_nonexisting_with_pipes
self.assertEqual(stderr, "")
AssertionError: 'Traceback (most recent call last):\n Fil[923 chars]le\n' != ''
Diff is 965 characters long. Set self.maxDiff to None to see it. Ran 2 tests in 0.171s FAILED (failures=1, skipped=1) 1 test failed: Total duration: 391 ms Here stderr is: Traceback (most recent call last):
File "C:\py\cpython3.7\lib\subprocess.py", line 1101, in _execute_child
args = os.fsdecode(args) # os.PathLike -> str
File "C:\py\cpython3.7\\lib\os.py", line 821, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "C:\py\cpython3.7\lib\subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "C:\py\cpython3.7\lib\subprocess.py", line 1104, in _execute_child
args[0] = os.fsdecode(args[0]) # os.PathLike -> str
File "C:\py\cpython3.7\\lib\os.py", line 821, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not tuple In _execute_child args is passed to os.fsdecode() unless it is a string. In this case args is a list. os.fsdecode() doesn't accept a list. The regression was introduced in bpo-31961. |
This is strange, because _execute_child calls os.fsdecode with Doesn't the try-except block actually catch this TypeError? I don't understand off the top of my head why my code doesn't catch this exception.. |
Also, isn't there continuous integration testing? Everything passed on the PR, so where does this come from? |
Wait a minute. The failing test is test_nonexisting_with_pipes, and it fails because args[0] is a tuple - how can that be? Nobody is supposed to pass cmd=sequence-where-first-element-is-a-tuple! Is everything all right with the test itself? |
Turns out this is a trivial typo in the test, so I stole the issue from Greg and pushed a PR. |
Sounds good to me |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: