How to set breakpoints in a library module (pdb)

前端 未结 1 1007
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 08:24

I am debugging a python script which sys.path looks like

sys.path = [\'\',\'home/my_library\', ..]

I\'m having troubles to set a breakpoint

相关标签:
1条回答
  • 2021-01-04 09:23

    You qualify the breakpoints with the filename, not the object name:

    >>> import pdb
    >>> import artwork  # module we want to break inside
    >>> pdb.set_trace()
    --Return--
    > <console>(1)<module>()->None
    (Pdb) b artwork/models.py:1
    Breakpoint 1 at /home/user/projects/artwork/models.py:1
    

    See also this answer.

    0 讨论(0)
提交回复
热议问题