microsoft / vscode-python-debugger

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

Python debugger not working properly in 1.88 with Git Bash shell #314

Closed IvanCobotic closed 2 weeks ago

IvanCobotic commented 5 months ago

Since I updated to VSCode 1.88 im facing issues with debugging python on windows. Im using

Environment Version: 1.88.1 (user setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

git version 2.44.0.windows.1 "terminal.integrated.defaultProfile.windows": "Git Bash"

If i run the following launch configuration

{
            "name": "Python: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        },

launching test.py

print('hello world')

with a breakpoint , the first time i launch the debugger i get the following commandline output $/usr/bin/env c:\\mygits\\deepose\\.venv\\Scripts\\python.exe c:\\Users\\IvanL\\.vscode\\extensions\\ms-python.debugpy-2024.4.0-win32-x64\\bundled\\libs\\debugpy\\adapter/../..\\debugpy\\launcher 52743 -- C:\\mygits\\deepose\\python\\experimental\\test.py

which is correct. If I then hit the restart debug command, i get

$^C
$anL\\.vscode\\extensions\\ms-python.debugpy-2024.4.0-win32-x64\\bundled\\libs\\debugpy\\adapter/../..\\debugpy\\launcher 52831 -- C:\\mygits\\deepose\\python\\experimental\\test.py 
bash: anL\.vscode\extensions\ms-python.debugpy-2024.4.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher: No such file or directory

which is incorrect, for some reason the /usr/bin/env c:\\mygits\\deepose\\.venv\\Scripts\\python.exe c:\\Users\\Iv got peeled of from the command line input.

JJ-empowered commented 5 months ago

Version: 1.88.1 (system setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

I'm seeing something very similar. I did find that if I kill the current terminals I have opened I can run the debugger exactly once. After this it will fail with the above mentioned error. If I kill all terminals again, I am then able to run the debugger once again before seeing this error.

cltien commented 5 months ago

Version: 1.88.1 (user setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.17763

After I updated VSC this morning, it won't be able to debug the python code anymore,

The last two lines of the messages look like these: [441C:3D80][2023-06-08T11:47:40]i001: Burn v3.10.4.4718, Windows v10.0 (Build 17763: Service Pack 0), path: C:\WINDOWS\Temp{15A7C23D-BD96-4211-9F47-AEAC065355A1}.cr\VC_redist.x64.exe ^ SyntaxError: invalid decimal literal

rotkiv1205 commented 4 months ago

I face the same issue.

parkhomenko-alexander commented 4 months ago

but all work good if default terminal is cmd

For-Lin0601 commented 4 months ago

I have this problem too. If someone finds a solution or if it's fixed in the next version, please tell me. for now, I'm using "console": "internalConsole" in launch.json, which lets me debug. but the internal console doesn't look as nice as my custom Git Bash terminal, maybe i will used the vscode1.87 instead

For-Lin0601 commented 3 months ago

i face the same in java on vscode-1.89. luckily, vscode-1.90 fixed this problem today.

eleanorjboyd commented 2 weeks ago

Hi! Looks like this might be fixed from the last comment, if not please comment and we can reopen. Thanks!