You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run Python File passes literal quotes in script path to terminal #26274
The top-right Run Python File button fails when the Python script is in a path containing spaces and Python Environments handles terminal execution.
Expected: Python runs the selected file.
Actual: The terminal receives a script argument with literal double quotation marks inside single quotes. Redacted equivalent of the observed command:
/usr/local/bin/python3 '"/path with spaces/main.py"'
Python reports [Errno 2] No such file or directory because the double quotation marks become part of the filename. The error path includes the current directory followed by "/path with spaces/main.py" instead of the actual script path.
Steps to reproduce
Install and enable the Python and Python Environments extensions.
Open a Python file inside a directory with spaces in its path.
Click the top-right Run Python File button.
Observe the terminal command and error.
Running the same script directly with a correctly quoted shell path succeeds.
Diagnostic data
VS Code: 1.145.0 (arm64)
Python extension: 2026.10.0
Python Environments extension: 1.42.0
Python interpreter: 3.14.7 at /usr/local/bin/python3
I'm not sure about this but perhaps the last update flipped the 'Use Environments Extension' toggle on? There is a mention in the Python settings that the default value changed.
Flipping this off fixes the problem temporarily until the real fix comes. Or using the debugger.
Thanks to everyone who reproduced this. A Windows report shows the same literal quotes in the script path, so this affects both PowerShell and Zsh.
I looked into the timing. The Python extension has passed a pre-quoted script path to Python Environments since #25405. Python Environments #1946 later changed terminal execution to quote arguments for Zsh and PowerShell. Together, those changes appear to produce the literal quotes in these reports.
That later change shipped in Python Environments 1.42.0 on November 4, the same evening my installation updated. This strongly suggests the update exposed the mismatch.
PR #26275 addresses it by passing the script path without added quotes.
Activity
akoronn commentedon Nov 9, 2026
Bug: "Run Python File" passes literal quotation marks in the script path on Windows PowerShell
Description
When using the Run Python File command in VS Code, extra double quotation marks are included in the script path passed to Python.
As a result, Python cannot locate the script and exits with an
Invalid argumenterror.This issue started occurring after a recent VS Code update. The same workflow worked correctly before the update.
Steps to Reproduce
Actual Behavior
VS Code generates the following command:
Notice that the script path contains an additional pair of double quotation marks inside the single-quoted PowerShell argument.
Python interprets these double quotation marks as part of the filename and fails to open the script.
Error message:
Expected Behavior
The command should pass the script path without the extra literal double quotation marks:
The script should execute normally.
Additional Information
This suggests that the issue is related to command generation or argument quoting in the Python extension's terminal execution path.
Environment
Operating System
VS Code
Python
.venv\Scripts\python.exeExtensions
ms-python.python): 2026.10.0ms-python.debugpy): 2026.7.13061010ms-python.vscode-python-envs): 1.43.2026110501ms-python.vscode-pylance): 2026.4.1MKuula commentedon Nov 10, 2026
I'm not sure about this but perhaps the last update flipped the 'Use Environments Extension' toggle on? There is a mention in the Python settings that the default value changed.
Flipping this off fixes the problem temporarily until the real fix comes. Or using the debugger.
BeniNobel commentedon Nov 10, 2026
Thanks to everyone who reproduced this. A Windows report shows the same literal quotes in the script path, so this affects both PowerShell and Zsh.
I looked into the timing. The Python extension has passed a pre-quoted script path to Python Environments since #25405. Python Environments #1946 later changed terminal execution to quote arguments for Zsh and PowerShell. Together, those changes appear to produce the literal quotes in these reports.
That later change shipped in Python Environments 1.42.0 on November 4, the same evening my installation updated. This strongly suggests the update exposed the mismatch.
PR #26275 addresses it by passing the script path without added quotes.
fung19942003 commentedon Nov 12, 2026
I have a similar issue on Windows with Git Bash as the VS Code
default terminal.
When I click “Run Python File”, the script path is passed with
double quotes inside single quotes:
python.exe '"C:/path with spaces/script.py"'
Python then reports: [Errno 22] Invalid argument.
Running the same file manually with correctly quoted paths works.
Ctrl+F5 with Python Debugger also works.
Shell: Git Bash
Python: 3.14
Vscode version : 1.145.2 (c4453f8ea430795f941c1b2ff6c9321135a74a02)