Fix Windows activation scripts to handle Python paths with spaces #3015
+69
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When Python is installed in a path containing spaces (e.g., C:\Program Files\Python39) on Windows, and a file named C:\Program exists on the filesystem, virtualenv's pydoc command fails with the error:
Unable to create process using 'c:\program files\python39\python.exe'
This happens because Windows command interpreter splits unquoted paths at spaces, interpreting C:\Program Files\Python39\python.exe as two separate arguments:
C:\Program (which exists as a file)
Files\Python39\python.exe
When Windows tries to execute C:\Program as if it were an executable, the command fails.
The issue stems from unquoted Python executable paths in activation scripts.
Solution:
Quotes ensure Windows treats the entire path as a single argument, even with spaces, and the call operator in PowerShell properly handles commands with spaces in their paths.
Fixes: #2985
tox -e fix)docs/changelogfolder