Description
Hello.
I've noticed in the recent version that, when trying to debug the following path:
├── my_package
│ ├── __init__.py
│ └── io.py
the breakpoints inside io won't work, and vscode won't even go into the file (in debug mode).
how to reproduce:
create a folder named "my_package" (just like it's in the tree shown earlier)
also add init.py (so we can import it)
inside io.py we can write some really simple code:
def custom_function():
x=1
return "hello"
now at the same dir as "my_package"
create a file (to import the package) run.py with the following:
from my_package.io import custom_function
custom_function()
add a breakpoint at custom_function run the debugger (F5 if using defaults), the expected course is that if we press F11 (go into) it will jump to io.py file at x=1. Here it just entirely skips the io.py file.
its easy to check what we expected by just changing the name of "io.py" to anything (by default vscode will rename the python imports at our run.py, if not, just rename from my_package.io -> my_package.renamed)
rerun in debug mode (F5)
with this, we can find the "custom_function" in debugger mode.
i've tested this both in linux (mint) and windows (win12), both had the latest version for vscode.
If it's necessary to add more description for this problem is necessary, please let me know.
Activity
lscheilling commentedon May 24, 2025
I've got the same issue with my project too, downgrading debugpy to
2024.10.0
seems to work for now, somewhat similar to microsoft/vscode-python-debugger#617rchiodo commentedon May 27, 2025
I believe it's failing because the module is considered a sys module and it thinks it's not your code. Not sure though why justMyCode wouldn't work then but the workaround is to rename the module to something other than 'io.py'.
rchiodo commentedon May 27, 2025
Somebody else reported this too. Marking as a dupe:
#1887