Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added import to handling example in the execute_api #656

Merged
merged 3 commits into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/execute_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ Handling errors
~~~~~~~~~~~~~~~
A useful pattern to execute notebooks while handling errors is the following::

from nbconvert.preprocessors import CellExecutionError

try:
out = ep.preprocess(nb, {'metadata': {'path': run_path}})
except CellExecutionError:
out = None
msg = 'Error executing the notebook "%s".\n\n' % notebook_filename
msg += 'See notebook "%s" for the traceback.' % notebook_filename_out
print(msg)
Expand Down
2 changes: 1 addition & 1 deletion nbconvert/preprocessors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .csshtmlheader import CSSHTMLHeaderPreprocessor
from .highlightmagics import HighlightMagicsPreprocessor
from .clearoutput import ClearOutputPreprocessor
from .execute import ExecutePreprocessor
from .execute import ExecutePreprocessor, CellExecutionError
from .regexremove import RegexRemovePreprocessor
from .tagremove import TagRemovePreprocessor

Expand Down