Note
Go to the end to download the full example code. or to run this example in your browser via JupyterLite or Binder
Example that fails to execute#This example demonstrates a code block that raises an error and how any code blocks that follow are not executed.
When scripts fail, their gallery thumbnail is replaced with the broken image stamp. This allows easy identification in the gallery display.
You will also get the python traceback of the failed code block.
14 # Code source: Óscar Nájera 15 # License: BSD 3 clause 16 # sphinx_gallery_line_numbers = True 17 18 import matplotlib.pyplot as plt 19 import numpy as np 20 21 plt.pcolormesh(np.random.randn(100, 100))
<matplotlib.collections.QuadMesh object at 0x7fcd961169e0>
This next block will raise a NameError
Traceback (most recent call last): File "/home/circleci/project/examples/no_output/plot_raise.py", line 26, in <module> iae # noqa NameError: name 'iae' is not defined
Sphinx gallery will stop executing the remaining code blocks after the exception has occurred in the example script. Nevertheless the html will still render all the example annotated text and code blocks, but no output will be shown.
Here is another error raising block but will not be executed
37 plt.plot("Strings are not a valid argument for the plot function")
Total running time of the script: (0 minutes 0.824 seconds)
Estimated memory usage: 571 MB
Gallery generated by Sphinx-Gallery
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4