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
Using the auto-generated launch configuration for debugging a Python script, and supplying command line arguments, a script cannot be debugged when python.exe is in a 'C:\Program Files' directory.
The launch script does not handle spaces in the filename of the python executable.
Steps to reproduce:
Create launch configurations for "Python Debugger: Current File with Arguments", and "Python Debugger: Current File". This should produce the following launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}"
},
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
Create a python script called test.py containing the following
Goto the 'Run and Debug' pane and select 'Python Debugger: Current File' from the drop down.
Press F5 to run the script. You should see the script being invoked in a similar way to the following.
PS C:\eng\users\clelandd\work\RSA2EA\python\find_ids> c:; cd 'c:\eng\users\clelandd\work\RSA2EA\python\find_ids'; & 'c:\Program Files\Python310_64\python.exe' 'c:\Users\clelandd.vscode\extensions\ms-python.debugpy-2025.6.0-win32-x64\bundled\libs\debugpy\launcher' '34765' '--' 'C:\eng\users\clelandd\work\RSA2EA\python\find_ids\test.py'
No parameter
Script runs.
Goto the 'Run and Debug' pane and select 'Python Debugger: Current File with Arguments' from the drop down.
Press F5 to run the script. Enter 'Test' into the 'Command Line Arguments' prompt that appears, then press Enter.
You should see the script being invoked as follows, and failing to run.
PS C:\eng\users\clelandd\work\RSA2EA\python\find_ids> c:; cd 'c:\eng\users\clelandd\work\RSA2EA\python\find_ids'; c:\Program Files\Python310_64\python.exe c:\Users\clelandd.vscode\extensions\ms-python.debugpy-2025.6.0-win32-x64\bundled\libs\debugpy\launcher 34837 -- C:\eng\users\clelandd\work\RSA2EA\python\find_ids\test.py ${command:pickArgs}
c:\Program: The term 'c:\Program' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
When invoked this way the path to the python executable is not being enclosed in quotes, resulting in an error.
launch.json configuration
The path to the Python executable is not correctly enclosed in quotes if the the "args:" parameter is added to a launch configuration.
Adding
"args": "${command:pickArgs}"
or a fixed value such as
"args": "test.txt"
to a launch configuration causes the error described.
Output for Python Debugger in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python Debugger)
Extension version: 2025.6.0
VS Code version: Code 1.99.1 (7c6fdfb0b8f2f675eb0b47f3d95eeca78962565b, 2025-04-04T15:58:59.624Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Python version (& distribution if applicable, e.g. Anaconda): 3.10.5
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): None
System Info
Item
Value
CPUs
Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600)
Type: Bug
Behaviour
Using the auto-generated launch configuration for debugging a Python script, and supplying command line arguments, a script cannot be debugged when python.exe is in a 'C:\Program Files' directory.
The launch script does not handle spaces in the filename of the python executable.
Steps to reproduce:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}"
},
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
import sys
if len(sys.argv) > 1:
print(f"Parm 1: ", sys.argv[1])
else:
print("No parameter")
Goto the 'Run and Debug' pane and select 'Python Debugger: Current File' from the drop down.
Press F5 to run the script. You should see the script being invoked in a similar way to the following.
PS C:\eng\users\clelandd\work\RSA2EA\python\find_ids> c:; cd 'c:\eng\users\clelandd\work\RSA2EA\python\find_ids'; & 'c:\Program Files\Python310_64\python.exe' 'c:\Users\clelandd.vscode\extensions\ms-python.debugpy-2025.6.0-win32-x64\bundled\libs\debugpy\launcher' '34765' '--' 'C:\eng\users\clelandd\work\RSA2EA\python\find_ids\test.py'
No parameter
Script runs.
Goto the 'Run and Debug' pane and select 'Python Debugger: Current File with Arguments' from the drop down.
Press F5 to run the script. Enter 'Test' into the 'Command Line Arguments' prompt that appears, then press Enter.
You should see the script being invoked as follows, and failing to run.
PS C:\eng\users\clelandd\work\RSA2EA\python\find_ids> c:; cd 'c:\eng\users\clelandd\work\RSA2EA\python\find_ids'; c:\Program Files\Python310_64\python.exe c:\Users\clelandd.vscode\extensions\ms-python.debugpy-2025.6.0-win32-x64\bundled\libs\debugpy\launcher 34837 -- C:\eng\users\clelandd\work\RSA2EA\python\find_ids\test.py ${command:pickArgs}
c:\Program: The term 'c:\Program' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
launch.json
configurationThe path to the Python executable is not correctly enclosed in quotes if the the "args:" parameter is added to a launch configuration.
Adding
"args": "${command:pickArgs}"
or a fixed value such as
"args": "test.txt"
to a launch configuration causes the error described.
Output for
Python Debugger
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython Debugger
)Extension version: 2025.6.0
VS Code version: Code 1.99.1 (7c6fdfb0b8f2f675eb0b47f3d95eeca78962565b, 2025-04-04T15:58:59.624Z)
OS version: Windows_NT x64 10.0.19045
Modes:
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: