Message375993
Following code:
```
from pathlib import Path
import os
import subprocess
dir_name = os.environ.get("WORKSPACE", None) or "."
output_directory = Path(dir_name) / "results"
res = subprocess.run(["mytest", "--output", output_directory])
```
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 `" " in Path("/tmp")` on posix platforms shows the same exception but with PosixPath type but apparently this sort of check does not happen on those platforms as the example code works fine there.
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. |
|
Date |
User |
Action |
Args |
2020-08-27 14:25:19 | rasjani | set | recipients:
+ rasjani, paul.moore, tim.golden, zach.ware, steve.dower |
2020-08-27 14:25:18 | rasjani | set | messageid: <1598538318.99.0.184680655713.issue41649@roundup.psfhosted.org> |
2020-08-27 14:25:18 | rasjani | link | issue41649 messages |
2020-08-27 14:25:18 | rasjani | create | |
|