Skip to content

Python Debugger fails to load Python3 if installed on a path with spaces #351

@fgiancane8

Description

@fgiancane8

Behaviour

It is expected to be able to debug a python script or module using the globally installed Python runtime from their website. It turns out that if installed via their setup, it gets deployed in C:\Program Files\Python312. The path contains a space which should be escaped when loading it, but it is not, resulting in misleading errors and not being able of debugging.

Steps to reproduce:

  1. Select "Start Debugging" (F5)
  2. Select "Python Debugger"
  3. Leave the command line empty
  4. Observe command line failure

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

PS C:\Users\fgiancan\source\repos\scripts>  c:; cd 'c:\Users\fgiancan\source\repos\scripts'; c:\Program Files\Python312\python.exe c:\Users\fgiancan\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 63087 -- C:\Users\fgiancan\source\repos\scripts\test.py
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.

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

2024-05-29 12:34:57.789 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-05-29 12:34:57.789 [info] Experiment 'pythonREPLSmartSend' is active
2024-05-29 12:34:57.789 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-05-29 12:34:57.789 [info] Experiment 'pythonTestAdapter' is active
2024-05-29 12:34:57.830 [info] Default formatter is set to null for workspace c:\Users\fgiancan\source\repos\scripts
2024-05-29 12:34:58.202 [info] > pyenv which python
2024-05-29 12:34:58.202 [info] cwd: .
2024-05-29 12:34:58.320 [info] > "c:\Program Files\Python312\python.exe" -I ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2024.6.0\python_files\interpreterInfo.py
2024-05-29 12:35:01.402 [warning] Shell integration may not be active, environment activated may be overridden by the shell.
2024-05-29 12:35:02.368 [info] Python interpreter path: c:\Program Files\Python312\python.exe
2024-05-29 12:35:04.514 [info] Starting Pylance language server.
2024-05-29 12:35:06.331 [info] Shell integration status changed, can confirm it's working.
2024-05-29 12:40:58.375 [info] Python interpreter path: C:\Program Files\Python312\python.exe
2024-05-29 12:41:11.680 [info] Send text to terminal:  c:\Program Files\Python312\python.exe c:\Users\fgiancan\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 63012 -- C:\Users\fgiancan\source\repos\scripts\test.py
2024-05-29 12:44:03.765 [info] Send text to terminal: �
2024-05-29 12:44:03.765 [info] Send text to terminal:  c:; cd 'c:\Users\fgiancan\source\repos\scripts'; c:\Program Files\Python312\python.exe c:\Users\fgiancan\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 63087 -- C:\Users\fgiancan\source\repos\scripts\test.py

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions