Closed Andrej730 closed 2 weeks ago
We do not handle breakpoint in the extension, I am not sure if this a vscode error or debugpy, sending it to debugpy.
@Andrej730, the issue is due to the way python optimizes the loading of the standard modules. The breakpoint() function or debugpy.breakpoint() are often the most reliable methods for debugging such scenarios.
You could also try attaching to the process and stepping into imporlib code,
Hope that helps.
I believe this is a special case. Debugpy uses importlib itself. We can't debug modules that are already loaded into the debugger by the debugger. Sticking a breakpoint()
in the code doesn't work for me either. It just hangs launching the debugger (well because it's using importlib).
How to reproduce: 1) Disable
justmycode
for debugpy (in my case it's disabled both in user and workspace settings).2) Create an empty python file.
3) Open
Python\Lib\importlib\__init__.py
and insert a breakpoint. You can add some print statement to get sense when we're past the breakpoint.4) Start debug for an empty python file with the "Python Debugger: Debug Python file".
5) Script will be executed but breakpoint is never triggered - though there will be print messages we added on step 3.
As a workaround it's possible to debug it with the classic
breakpoint()
though it's not as convenient.