[Python] Python debugger skips breakpoint when module name conflicts with standard library...

Discussão em 'Python' iniciado por Stack, Junho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering a strange issue while debugging a Python project: breakpoints inside a third-party module are not being hit (I've already set justMyCode to false in "launch.json"), even though the code is clearly being executed.

    The third-party library in my project has the following structure:

    langgraph/
    └── utils/
    └── queue.py


    I'm trying to set a breakpoint inside langgraph/utils/queue.py. The code definitely runs (I've confirmed it with print() and inspect.getfile()), but the debugger completely skips the breakpoint.

    The queue.py file contains the following code:

    # langgraph/utils/queue.py
    def helloworld():
    print("hello world")


    In my actual working project, I import and call it like this:

    [​IMG]

    # test_script.py (run this file)
    from langgraph.utils.queue import helloworld
    def test():
    helloworld()
    if __name__ == "__main__":
    test()


    I've set a breakpoint inside helloworld() in queue.py. When I start debugging (e.g., using VSCode):


    • The script runs successfully and prints hello world.


    • However, the debugger does not pause at the breakpoint inside queue.py.


    • It simply runs through the function as if no breakpoint were there.

    Here's what I’ve tried so far without any success:

    • Explicitly importing with from langgraph.utils import queue.
    • Setting "justMyCode": false in VSCode launch.json.
    • Clearing pycache, restarting the debugger.
    • Printing file and using inspect.getfile(...) to confirm the correct file is loaded.

    What I have Observed:

    The module does get executed, but breakpoints do not trigger.

    If I rename queue.py to something like task_queue.py, breakpoints start working correctly.

    I suspect that since my module is named queue.py, the same as a Python standard library module (queue), the debugger might be getting confused — possibly binding the breakpoint to the wrong file, even though the full import path is different.

    My environment is the following:

    • Python version: 3.10 an 3.12 and 3.13
    • IDE: VS Code and PyCharm
    • OS: Windows

    Is this a known limitation of Python's module system or the debugger (VS Code in this case)?

    Is there any way to force the debugger to bind the breakpoint to my version of queue.py without renaming the file?

    Are there any best practices or debugger settings to avoid this kind of name conflict?

    Continue reading...

Compartilhe esta Página