microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
41 stars 17 forks source link

Debug using launch.json doesn't include apostrophe in string #272

Closed banyula closed 2 months ago

banyula commented 3 months ago

Python-debugger-error Type: Bug

Behaviour

Expected vs. Actual

Trying to debug Python program when using option "Python Debugger: Debug using launch.json" there is an execution error (see screenshot)

Steps to reproduce:

  1. Python 3.8 installed for all users in Windows (C:\Program Files\Python38\python.exe).
  2. When debugging using "Python Debugger: Debug Python file" option, the debugger starts perfectly and without errors. Executing string is:

c:; cd 'c:\Temp\FR'; & 'c:\Program Files\Python38\python.exe' 'c:\Users\mmiller.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '61954' '--' 'C:\Temp\FR\CallFlexResponse.py'

  1. When trying to debug using "Python Debugger: Debug using launch.json" there are execution errors because strings to execute are not surrounded by single quotes, and file path contains spaces. Executing string is:

c:; cd 'c:\Temp\FR'; c:\Program Files\Python38\python.exe c:\Users\mmiller.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 6198ndled\libs\debugpy\adapter/../..\debugpy\launcher 61984 -- C:\Temp\FR.vscode\launch.json myarg

Diagnostic data

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

``` 2024-03-18 20:48:48.700 [info] DAP Server launched with command: C:\Program Files\Python38\python.exe c:\Users\mmiller\.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter ```

User Settings

``` languageServer: "Pylance" ```

Extension version: 2024.2.0 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz (1 x 2611)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: disabled_off
opengl: enabled_on
rasterization: unavailable_off
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)|4.00GB (0.77GB free)| |Process Argv|| |Screen Reader|no| |VM|100%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 2e7ec940:30992800 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfcontrol:30979541 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 dsvsc020:30976470 7ghi1836:30988842 ```
paulacamargo25 commented 2 months ago

This bug will be solved here.