How to automatically execute next cell even if an error occurs in the current cell in Jupyter?

断了今生、忘了曾经 提交于 2021-01-28 02:03:38

问题


I am running a cell in Jupyter notebook where an error is bound to occur after some time(usually hours). But even after this error occurs, I want the compiler to just move on to the next cell and run the remaining cells that I put in the queue to be run after this cell finishes.

I know exceptions might be able to do this, but I wanted to know if there was any other way specific to Python or Jupyter notebook that might do the trick.

Cell 1: Some code running # Error will occur here and stop the execution

Cell 2,3...,n: Some code # Code should still run after the error occurs in Cell 1

Thanks for any solutions. The help is appreciated.


回答1:


There's a Jupyter Notebook nbextensions extension called Runtools which allows you to run all cells and ignore errors with the shortcut Alt + F. See Installing jupyter_contrib_nbextensions on how to install nbextensions and enable extensions like Runtools.



来源:https://stackoverflow.com/questions/56402480/how-to-automatically-execute-next-cell-even-if-an-error-occurs-in-the-current-ce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!