[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

Nathaniel Smith report at bugs.python.org
Mon Feb 5 17:33:14 EST 2018


Nathaniel Smith <njs at pobox.com> added the comment:

I think I agree with Serhiy here... the whole difference between run([a]) and run(a) is that in the first case 'a' is treated as a path, and in the second it isn't. This distinction long predates pathlib.

Say I have an oddly named binary with an embedded space in its name:

bin = Path("/bin/ls -l")

# Check that this weird file actually exists:
assert bin.exists()

# runs this weird file
subprocess.run([bin])

# Currently an error; if this is implemented, would run
# /bin/ls, and pass it the -l argument. Refers to something
# completely different than our .exists() call above.
subprocess.run(bin)

----------
nosy: +njs

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31961>
_______________________________________


More information about the Python-bugs-list mailing list