Author rasjani
Recipients paul.moore, rasjani, steve.dower, tim.golden, zach.ware
Date 2020-08-27.14:25:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598538318.99.0.184680655713.issue41649@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-08-27 14:25:19rasjanisetrecipients: + rasjani, paul.moore, tim.golden, zach.ware, steve.dower
2020-08-27 14:25:18rasjanisetmessageid: <1598538318.99.0.184680655713.issue41649@roundup.psfhosted.org>
2020-08-27 14:25:18rasjanilinkissue41649 messages
2020-08-27 14:25:18rasjanicreate