Skip to content

Fix Run Python File paths with spaces when using Python Environments - #26275

Open
Beni Inganji (BeniNobel) wants to merge 1 commit into
microsoft:mainfrom
BeniNobel:fix/run-python-file-double-quoting
Open

Beni Inganji (BeniNobel) wants to merge 1 commit into
microsoft:mainfrom
BeniNobel:fix/run-python-file-double-quoting

Conversation

@BeniNobel

Copy link
Copy Markdown

Fixes #26274

Summary

Pass the script path as a raw argument to the Python Environments terminal API. The previous path helper added shell quotes before calling an API that handles arguments itself, so those quotes became part of the filename. Windows slash normalization is preserved.

Testing

  • npx gulp prePublishNonBundle
  • npm run checkDependencies
  • npm run lint
  • npm run format-check
  • git diff --check
  • Terminal unit tests: 107 passed, including the new regression test for all three Run Python File command variants and paths with spaces, quotes, apostrophes, and shell metacharacters.
  • Full TypeScript unit suite on Node 22: 5,276 passed, 36 Windows-only tests pending, and 2 failures in the unrelated macOS locator test file. Excluding that file: 5,275 passed, 36 pending, 0 failures.
  • VS Code extension-host verification with Python Environments 1.42.0: 3/3 scripts passed with shell integration enabled and 3/3 with it disabled. The installed unpatched Python extension failed all three corresponding checks.
  • Clicked the top-right Run Python File button in an isolated VS Code instance with the patched extension; a script in a path containing spaces ran successfully.

Review notes

The change affects only the Python Environments terminal path. Python Environments 1.40.0 still fails for some filenames containing shell metacharacters; this PR does not change that version's handling. The 36 pending unit tests are Windows-only and were not run on macOS.

Suggested impact label: bug.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@BeniNobel

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Python File passes literal quotes in script path to terminal

2 participants