Trace Python imports

前端 未结 2 1748
小鲜肉
小鲜肉 2020-11-27 19:02

My Python library just changed it\'s main module name from foo.bar to foobar. For backward compat, foo.bar still exists, but importing

2条回答
  •  一个人的身影
    2020-11-27 19:38

    edit foo.bar module, add following code:

    import pdb
    pdb.set_trace()
    

    when foo.bar be imported, program will stop at pdb.set_trace() in pdb mode, where you can debug your code. For example, you can use "w" command to print the full calling stack.

提交回复
热议问题