#!/usr/bin/env python # coding: utf-8 # This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/. # # Ignoring Errors # # Normally, if an exception is raised while executing a notebook, the Sphinx build process is stopped immediately. # # If a notebook contains errors on purpose (or if you are too lazy to fix them right now), you have four options: # # 1. Manually execute the notebook in question and save the results, see [the pre-executed example notebook](pre-executed.ipynb). # # 2. Allow errors in all notebooks by setting this option # in [conf.py](conf.py): # # ```python # nbsphinx_allow_errors = True # ``` # # 3. Allow errors on a per-notebook basis by adding this to the notebook's # JSON metadata: # # ``` # "nbsphinx": { # "allow_errors": true # }, # ``` # # 4. Allow errors on a per-cell basis using the `raises-exception` tag, see [Ignoring Errors on a Cell-by-Cell Basis](allow-errors-per-cell.ipynb). # # This very notebook is an example for the third option. # The results of the following code cells are not stored within the notebook, therefore it is executed during the Sphinx build process. # Since the above-mentioned `allow_errors` flag is set in this notebook's metadata, all cells are executed although most of them cause an exception. # In[ ]: nonsense # In[ ]: 42 / 0 # In[ ]: 6 * 7