Example that fails to execute

When scripts fail their gallery thumbnail is replaced with the broken image stamp. Thus allowing easy identification in the gallery display.

You also get the python traceback of the failed code block

12
13
14
15
16
17
18
19
 # Code source: Óscar Nájera
 # License: BSD 3 clause
 # sphinx_gallery_line_numbers = True

 import numpy as np
 import matplotlib.pyplot as plt

 plt.pcolormesh(np.random.randn(100, 100))
../../_images/sphx_glr_plot_raise_001.png

This next block will raise a NameError

24
 iae
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/sphinx-gallery/envs/latest/lib/python3.5/site-packages/sphinx_gallery-0.3.dev0-py3.5.egg/sphinx_gallery/gen_rst.py", line 405, in _memory_usage
    out = func()
  File "/home/docs/checkouts/readthedocs.org/user_builds/sphinx-gallery/envs/latest/lib/python3.5/site-packages/sphinx_gallery-0.3.dev0-py3.5.egg/sphinx_gallery/gen_rst.py", line 393, in __call__
    exec(self.code, self.globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/sphinx-gallery/checkouts/latest/examples/no_output/plot_raise.py", line 24, in <module>
    iae
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

35
 plt.plot('Strings are not a valid argument for the plot function')

Total running time of the script: ( 0 minutes 0.147 seconds)

Gallery generated by Sphinx-Gallery