#!/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 three 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): # ``` # 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 # }, # ``` # # This very notebook is an example for the last 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[ ]: print 'Hello, world!' # In[ ]: 6 ~ 7 # In[ ]: 6 * 7