Running debugpy with embedded interpreter on Windows #1827
-
I have an application that embeds Python 3.11. I can successfully attach debugpy from vs code using:
However it doesn't stop at any breakpoints. Neither does it if I press the pause button. When enabling debugpy logs I can see that it's sending the corresponding requests for the Pause and breakpoints. E.g. for the Pause Request I get:
On Linux I can debug the application just fine. However there we use a slightly different setup (we link the system Python instead of a self built CPython version + we use Python 3.11 instead of 3.13). I am a bit lost as to what could cause this. Any pointers would be helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
That should be normal for a non python application. There are threads running that don't have python code in them. What did the stack trace request after that point show? Additionally, if you enable DEBUG_PYDEVD_PATHS_TRANSLATION=True as an environment variable, it should print out more information about why the breakpoints aren't binding. Native apps embedding python might load your code as a string for example, so you wouldn't be able to set breakpoints ahead of time. You'd have to add |
Beta Was this translation helpful? Give feedback.
Are you saying breakpoints work in Visual Studio (mixed mode), but they don't in VS Code for the same app? I mean it makes sense, it's two different debuggers. But theoretically they should be searching for breakpoints the same way.
But in debugpy if the breakpoints aren't being hit, that generally means debugpy doesn't think that code is running (or it already ran). The tracing of frame output makes it look like that code isn't running.
If you're running a C++ app and it runs a script, you have to pause the script in order to attach debugpy. That might be what you're hitting. Whereas in Visual Studio with mixed mode, you actually attach a C++ debugger and it just translates python stack …