blender-debugger-for-vscode
blender-debugger-for-vscode copied to clipboard
Debugger is attached but can't stop on breakpoints
OS: Windows 10
Add-on Version: 2.2.0
Blender Version: 3.2.1
VS Code Version: 1.69.2
VS Code Python Extension Version: v2022.10.1
- debugpy version: 1.6.2
Paths listed by where python
or the corresponding command:
where python
C:\Program Files\Blender Foundation\Blender 3.2\3.2\python\bin\python.exe
C:\Program Files\FreeCAD 0.18\bin\python.exe
C:\Users\carolisa\AppData\Local\Programs\Python\Python310\python.exe
Does VS Code / Visual Studio connect to the troubleshooting script? Yes
Python path/interpreter detected/selected by VS Code/Visual Studio: C:\Users\carolisa\AppData\Local\Programs\Python\Python310\python.exe
Blender and VSCode connect succesfully ( see picture attached ). But if I set a breakpoint on VsCode (on the print("test") statement) and I run the script with Alt-P on Blender, the breakpoint is ignored.
Maybe failed to upload in the message above...
I found that if I move my python source code file on c:, everything works. It seems the debugger can't find the source code and looks on c:. How to specify the right path?
Where was the script located and where did you move it to that it now works?
Also running scripts from Blender can be a problem. I remember some potential workarounds were discussed in #4, but I never got around to investigating.
Not certain I was hitting the same issue, but after considerable head-scratching as to why the debugger couldn't match the source file I placed breakpoints in with the source of the addon, I decided to dig around VSCode for source path search settings (similar to Visual Studio) and found that you can specify the search path directly (vscode edit->preferences->settings then search for "debug path") (the add-on I wanted to debug was in c:\temp\addons...) Restarted blender, reconnected the debugger and it worked as expected.
What solved the issue for me was to change the auto-generated VSCode launch.json file. Specifically, "pathMappings.remoteRoot"
should be set to "${workspaceFolder}"
instead of the default "."
.
here is my complete launch.json:
{
// 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: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}" // I think this did the trick
}
],
"justMyCode": false
}
]
}
Change removeRoot
to ${workspaceFolder}
works for me! Thank you! 😸
Had the same issue. The solution mentioned by DaseinPhaos worked for me too.
I will see if I can reproduce this and add it to the docs if so. Also @rlneumiller that is from a separate VS Code extension and not an internal setting of VS Code.
I have the same problem and unfortunately, setting the path as @DaseinPhaos suggested did not work for me. Blender 3.65 and VSCode 1.88.1 with Python 3.10.11. Is anyone else still having problems with Breakpoints not triggering?