Skip to content

Accept path-like arguments in shlex.join() #132194

Open
@FFY00

Description

@FFY00

Feature or enhancement

Proposal:

A common use-case of shlex.join is to get a shell-like invocation of a command.

In my experience, when writing small custom scripts, it is very common to use shlex.join in conjunction with subprocess.run, to log the command invocation to the output. subprocess.run has accepted path-like arguments since 3.6 on POSIX, and 3.8 on Windows, so when we want to use shutil.join, we need extra code to convert the path-like objects in the command sequence to strings.

It would be nice if shutil.join could receive the same command sequence as subprocess.run.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

GH-72809 proposed this for shlex.quote.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions