[issue45130] shlex.join() does not accept pathlib.Path objects

Richard report at bugs.python.org
Tue Sep 7 15:03:03 EDT 2021


Richard <nyuszika7h at gmail.com> added the comment:

While it may be primarily intended to combine output from shlex.split() again, IMO it's useful for manually constructed command lines as well, for example displaying instructions to a user where a path may contain spaces and special characters and needs to be properly escaped.

As for converting int to str, since subprocess.run() does not do that, shlex.split() does not need to do so either. I never mentioned that, and while I could see that being useful as well, that would have to be a separate discussion.

There's more of a case for automatic conversion for Path objects, which are supposed to work seamlessly in most places where strings are accepted. But such quirks of certain functions not accepting them and being forced to convert to str manually makes pathlib a little annoying to use compared to os.path.

----------

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


More information about the Python-bugs-list mailing list