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

debugger cannot be used #1707

Open
StrawberryGZ opened this issue Oct 17, 2024 · 15 comments
Open

debugger cannot be used #1707

StrawberryGZ opened this issue Oct 17, 2024 · 15 comments
Assignees
Labels
needs repro Issue has not been reproduced yet waiting for response

Comments

@StrawberryGZ
Copy link

StrawberryGZ commented Oct 17, 2024

Hi guys,

I don't know why my debugger cannot be used. I tried to changed the python version from the latest one to 2022.4.0 and it still cannot work.

And I followed an instruction to change my launch.json to this:

{
    // 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: 
        //     "type": "python",
        //     "request": "launch",
        //     "program": "${file}",
        //     "console": "integratedTerminal",
        //     "justMyCode": true
        // }    
        {
                "name": "Python", 
                "type": "debugpy",
                "request": "launch",
                "stopOnEntry": false, 
                "python": "D:\\softwares\\anaconda\\python.exe", 
                "program": "${file}",
                "cwd": "${workspaceRoot}",
                "console": "integratedTerminal",
                "justMyCode": true, //只调试自己的Code
                "env": {},
                "envFile": "${workspaceRoot}/.env",
                "redirectOutput": true
        }
    ]
}

vscode Version: 1.94.2 (user setup)
python debugger: v2024.12.0
python: v2024.16.1
pylance: v2024.10.1

AND things aren't change, I still cannot use debugger, plsssssssss help!!!

@karthiknadig
Copy link
Member

karthiknadig commented Oct 17, 2024

Can you elaborate on what you mean by it does not work? Can you share a video or gif of the issue? Can you also sare the logs from Output > Python Debugger?

Also, try this:

{
    "version": "0.2.0",
    "configurations": [
        {
                "name": "Python", 
                "type": "debugpy",
                "request": "launch",
                "program": "${file}",
                "cwd": "${workspaceRoot}",
                "console": "integratedTerminal",
                "justMyCode": true, //只调试自己的Code
        }
    ]
}

@karthiknadig karthiknadig self-assigned this Oct 17, 2024
@StrawberryGZ
Copy link
Author

Image
Image
Hi, karthiknadig
pls see the attachements, if u need anything pls let me know.

@karthiknadig
Copy link
Member

@StrawberryGZ In the video it looks like you have several configurations (green square below)
Image

Select the first config then click on the gear icon. See if it opens the correct configuration.

@StrawberryGZ
Copy link
Author

Image
as u can see, I don't think it is the problem of the configuration

@karthiknadig
Copy link
Member

Can you share the logs from Output > Python Debugger?

@StrawberryGZ
Copy link
Author

2024-10-18 14:57:06.733 [info] Resolving launch configuration with substituted variables
2024-10-18 14:57:06.742 [info] DAP Server launched with command: d:\softwares\anaconda\python c:\Users\Yanbo.Zhang7.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\adapter

python debugger output logs are like this

@karthiknadig karthiknadig removed their assignment Oct 18, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python-debugger Oct 18, 2024
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 18, 2024
@karthiknadig
Copy link
Member

If you see the screenshot of the logs here:
Image

It looks like the extension is submitting the correct adapter path and python. It looks like debugpy is failing to start because you can see the brief moment of the debug session starting.

I suspect either a library shadowing issue or extension corruption.

@rchiodo
Copy link
Contributor

rchiodo commented Oct 18, 2024

@StrawberryGZ what does the terminal say? Running the debugger should output something in the terminal.

For me it does this:

PS C:\Users\rchiodo\source\testing\test_auto_import>  & 'c:\Users\rchiodo\AppData\Local\Microsoft\WindowsApps\python3.11.exe' 'c:\Users\rchiodo\.vscode-insiders\extensions\ms-python.debugpy-2024.13.2024101501-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '62219' '--' 'C:\Users\rchiodo\source\testing\test_auto_import\app\db\test.py' 

That will likely show whatever error is occurring.

@karthiknadig
Copy link
Member

@StrawberryGZ You can also try running this from the terminal:
d:\softwares\anaconda\python c:\Users\Yanbo.Zhang7\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\adapter

If there is any issue it will throw an error. If there are no issue then it will be blank. You can terminate the process using ctrl+c.

@rchiodo If it fails before the DAP server has the opportunity to start then they might not see the terminal command. The above should indicate if something is failing before it can start the server. If that does not fail, then the next step is to manually launch the DAP server, using the debug server mode, and you can then connect to it from VS Code using debugServer in launch config. This way you can check if the server is starting independent of VS Code. Then launch config will then attach to the DAP server, from that point on it goes through the same process as regular launch. We use this to isolate issue between debugpy and the extension.

@StrawberryGZ
Copy link
Author

hi guys, I tried again. and nothing showed up in the terminal output. It seems debugger does not start.

@rchiodo
Copy link
Contributor

rchiodo commented Oct 18, 2024

Nothing shows up, not even the command?

This:

'c:\Users\rchiodo\AppData\Local\Microsoft\WindowsApps\python3.11.exe' 'c:\Users\rchiodo.vscode-insiders\extensions\ms-python.debugpy-2024.13.2024101501-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '62219' '--' 'C:\Users\rchiodo\source\testing\test_auto_import\app\db\test.py'

@StrawberryGZ
Copy link
Author

Image

Like this.

@rchiodo
Copy link
Contributor

rchiodo commented Oct 21, 2024

What happens if you run the command yourself like @karthiknadig asked.

Run this from a terminal:

d:\softwares\anaconda\python c:\Users\Yanbo.Zhang7\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\adapter

@StrawberryGZ
Copy link
Author

Image
sorry for the late response, it shows like this

@rchiodo
Copy link
Contributor

rchiodo commented Oct 25, 2024

Can you follow the directions here and upload the logs?
https://github.com/microsoft/debugpy/wiki/Enable-debugger-logs

That should show the commands sent to the debugger and sent back to VS code. I suspect VS code is not getting the commands or is erroring when receiving them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet waiting for response
Projects
None yet
Development

No branches or pull requests

4 participants