Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging with arguments does not work with spaces in path to python.exe #313

Closed
spkl opened this issue Apr 11, 2024 · 3 comments
Closed
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@spkl
Copy link

spkl commented Apr 11, 2024

Type: Bug

Behaviour

When the path to the python.exe contains spaces (e. g. c:\Program Files\Python311\python.exe), debugging with arguments is not possible.

The terminal shows the following:

PS C:\Data\Temp\py>  c:\Program Files\Python311\python.exe c:\Users\SebastianF\.vscode\extensions\ms-python.debugpy-2024.4.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 53374 -- C:\Data\Temp\py\script.py aaa 
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.

After a few seconds, an error dialog "Timed out waiting for launcher to connect" appears.

Depending on the path, a workaround can be used by specifying a path with shortened names, e.g. c:\Progra~1\Python311\python.exe. This is not easily discoverable.

Steps to reproduce:

Precondition: In the settings, the python default interpreter path contains spaces.

  1. Create a .py file and type some code
  2. Press F5
  3. Select "Python Debugger"
  4. Select "Python File with Arguments"
  5. Type some command line arguments and confirm

Diagnostic data

launch.json configuration

Not tested with launch.json.

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

2024-04-11 14:13:27.381 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-04-11 14:13:27.381 [info] Experiment 'pythonREPLSmartSend' is active
2024-04-11 14:13:27.381 [info] Experiment 'pythonSurveyNotification' is active
2024-04-11 14:13:27.381 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-04-11 14:13:27.382 [info] Experiment 'pythonTestAdapter' is active
2024-04-11 14:13:27.382 [info] Default formatter is set to null for workspace c:\Repos\VEcuGenCLI
2024-04-11 14:13:27.382 [info] Test server listening.
2024-04-11 14:13:27.382 [info] Python interpreter path: C:\Program Files\Python311\python.exe
2024-04-11 14:13:28.475 [info] > pyenv which python
2024-04-11 14:13:28.475 [info] cwd: .
2024-04-11 14:13:33.514 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-04-11 14:13:33.515 [info] Experiment 'pythonREPLSmartSend' is active
2024-04-11 14:13:33.515 [info] Experiment 'pythonSurveyNotification' is active
2024-04-11 14:13:33.515 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-04-11 14:13:33.515 [info] Experiment 'pythonTestAdapter' is active
2024-04-11 14:13:33.515 [info] Default formatter is set to null for workspace c:\Data\Temp\py
2024-04-11 14:13:33.515 [info] Test server listening.
2024-04-11 14:13:33.516 [info] Python interpreter path: C:\Program Files\Python311\python.exe
2024-04-11 14:13:33.641 [info] > pyenv which python
2024-04-11 14:13:33.641 [info] cwd: .
2024-04-11 14:13:35.744 [info] Shell integration status changed, can confirm it's working.
2024-04-11 14:13:36.273 [info] Starting Pylance language server.
2024-04-11 14:17:15.687 [info] Send text to terminal:  c:\Program Files\Python311\python.exe c:\Users\SebastianF\.vscode\extensions\ms-python.debugpy-2024.4.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 53374 -- C:\Data\Temp\py\script.py aaa 

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

2024-04-11 14:13:33.750 [info] Name: Python Debugger
2024-04-11 14:13:33.751 [info] Module: debugpy
2024-04-11 14:17:13.811 [info] DAP Server launched with command: C:\Program Files\Python311\python.exe c:\Users\SebastianF\.vscode\extensions\ms-python.debugpy-2024.4.0-win32-x64\bundled\libs\debugpy\adapter

Extension version: 2024.4.0
VS Code version: Code 1.88.0 (5c3e652f63e798a5ac2f31ffd0d863669328dc4c, 2024-04-03T13:26:18.741Z)
OS version: Windows_NT x64 10.0.22621
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.5
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-1370P (20 x 2189)
GPU Status 2d_canvas: enabled
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
Load (avg) undefined
Memory (System) 31.66GB (17.58GB free)
Process Argv --crash-reporter-id 61824c55-0e6f-4712-8416-7986cd431914
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
8082a590:30971561
fegfb526:30981948
bg6jg535:30979843
ccp2r6:30993542
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
dsvsc021:30996838
gd77d436:30999572
945dj816:31013170

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 11, 2024
@Ava-Carsten
Copy link

Hey!

I am have the exact same problem.

Added information: I was following this guide to enable debugging Python with command line arguments: https://devblogs.microsoft.com/python/python-in-visual-studio-code-august-2023-release/ > Debugger configuration for running files with arguments

This is the launch.json that got created in the process:

{
    // 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}"
        }
    ]
}

@bpeikes-tl
Copy link

I think this is a dupe of:
#233

@paulacamargo25
Copy link
Contributor

Duplicated of #233

@paulacamargo25 paulacamargo25 closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

5 participants