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 is attached but can't stop on breakpoints #28

Open
SanzioCaroli opened this issue Jul 22, 2022 · 9 comments
Open

Debugger is attached but can't stop on breakpoints #28

SanzioCaroli opened this issue Jul 22, 2022 · 9 comments

Comments

@SanzioCaroli
Copy link

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.
Uploading Capture.JPG…

@SanzioCaroli
Copy link
Author

Capture
Maybe failed to upload in the message above...

@SanzioCaroli
Copy link
Author

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?

@AlansCodeLog
Copy link
Owner

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.

@rlneumiller
Copy link
Contributor

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...)
image
Restarted blender, reconnected the debugger and it worked as expected.

@DaseinPhaos
Copy link

DaseinPhaos commented Jan 10, 2023

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
        }
    ]
}

@aoirusann
Copy link

aoirusann commented Jan 30, 2023

Change removeRoot to ${workspaceFolder} works for me! Thank you! 😸

@johnzero7
Copy link

Had the same issue.
The solution mentioned by DaseinPhaos worked for me too.

@AlansCodeLog
Copy link
Owner

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.

@Praevelox1
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants