-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Can't pass Path like objects to subprocess api's on Windows. #85815
Comments
Following code:
Works on macos and linux but on windows, this causes "TypeError: argument of type 'WindowsPath' is not iterable" at https://github.com/python/cpython/blob/master/Lib/subprocess.py#L568 (line is different, depending on the actual python release but i guess that gives the idea where it is).. Quick test to check if i can do It would be nice to be able to pass path objects to subprocess api calls also in windows without explicitly casting the object into string before passing it as argument. |
See also https://bugs.python.org/issue31961 |
I went thru the comments of the report you linked. It definitely looks like the discussion was related but it didnt really fix the issue here. https://bugs.python.org/issue31961#msg311775 without trying out, that comment actually touches the underlying issue, on windows, list2cmdline throws that typeerror because iterated argument list (output_directory in my example) is WindowsPath and thus not iterable and and testing the arg with "in" operator fails .. |
I do not understand how you get this result. At that line of code arg can only be string, because it is a result of os.fsdecode(). Are you sure that you use Python version which includes bpo-31961 changes? What exactly Python version do you use? |
I closed bpo-41753 as a duplicate of this. On that issue, Eryk Sun said "The underlying subprocess.Popen class was updated in 3.8 to support path-like objects in The latter is because 3.6 and 3.7 only get security patches. Jani, please verify that this is still an issue with 3.8 and/or 3.9. |
For Windows support, this includes workarounds for python/cpython#85815.
For Windows support, this includes workarounds for python/cpython#85815.
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: