This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, hokiedsp, paul.moore, steve.dower, tim.golden, zach.ware
Date 2022-02-09.04:29:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I checked the source code in PC/launcher.c process(). It turns out that `executable` is not getting quoted in the venv launcher case.

CreateProcessW() tries to get around this. If the command isn't quoted, it has a loop that consumes up to a space (or tab) and checks for an existing file (not a directory). If it finds a file, it rewrites the command line to quote the path of the file.

My test happened to work. But it's simple enough to create an example that fails. For example, as an elevated admin, create a file named "C:\Program". Now the venv launcher won't be able to execute a base interpreter that's installed in "C:\Program Files":

    C:\Temp>echo >C:\Program
    C:\Temp>"C:\Program Files\Python310\python.exe" -m venv env
    Error: Command '['C:\\Temp\\env\\Scripts\\python.exe', '-Im', 
    'ensurepip', '--upgrade', '--default-pip']' returned non-zero 
    exit status 101.
Date User Action Args
2022-02-09 04:29:51eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, hokiedsp
2022-02-09 04:29:51eryksunsetmessageid: <>
2022-02-09 04:29:51eryksunlinkissue46686 messages
2022-02-09 04:29:51eryksuncreate