DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Debug Scripts in Jupyter Notebook


To debug codes in a jupyter notebook:

  1. Add from IPython.core.debugger import set_trace into the script;

  2. Add set_trace() as the breakpoint;

  3. Run this cell.

Note:

When the breakpoint is in the body of a function, running the cell will not invoke ipdb, but call the function will invoke ipdb.

After the debugging is done, remove set_trace(). And rerun the script with menu item Kernel > Restart & Run All.



Published

Dec 9, 2017

Last Updated

Dec 9, 2017

Category

Tech

Tags

  • debug 2
  • ipdb 2
  • jupyter 6
  • notebook 5

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor