What is the right way to debug in iPython notebook?

前端 未结 10 1670
不知归路
不知归路 2020-11-30 16:50

As I know, %debug magic can do debug within one cell.

However, I have function calls across multiple cells.

For example,

In[1]:          


        
10条回答
  •  春和景丽
    2020-11-30 17:41

    You can use ipdb inside jupyter with:

    from IPython.core.debugger import Tracer; Tracer()()
    

    Edit: the functions above are deprecated since IPython 5.1. This is the new approach:

    from IPython.core.debugger import set_trace
    

    Add set_trace() where you need a breakpoint. Type help for ipdb commands when the input field appears.

提交回复
热议问题