Skip to content

bug in debugger mode with extensions ending with */io.py #1902

Closed
@ms-cmy

Description

@ms-cmy

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

lscheilling commented on May 24, 2025

@lscheilling

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#617

rchiodo

rchiodo commented on May 27, 2025

@rchiodo
Contributor

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'.

self-assigned this
on May 27, 2025
rchiodo

rchiodo commented on May 27, 2025

@rchiodo
Contributor

Somebody else reported this too. Marking as a dupe:
#1887

added
duplicateThis issue or pull request already exists
on May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingduplicateThis issue or pull request already exists

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    bug in debugger mode with extensions ending with */io.py · Issue #1902 · microsoft/debugpy