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

Add an invalid notebook error #1675

Merged
merged 2 commits into from Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion nbconvert/filters/markdown_mistune.py
Expand Up @@ -160,7 +160,10 @@ def image(self, src, title, text):
attachment_prefix = 'attachment:'
if src.startswith(attachment_prefix):
name = src[len(attachment_prefix):]
assert name in attachments, "missing attachment: {}".format(name)

if not name in attachments:
nbconvert.InvalidNotebook.new("missing attachment: {}".format(name))
gwincr11 marked this conversation as resolved.
Show resolved Hide resolved

attachment = attachments[name]
# we choose vector over raster, and lossless over lossy
preferred_mime_types = ['image/svg+xml', 'image/png', 'image/jpeg']
Expand Down
3 changes: 3 additions & 0 deletions nbconvert/nbconvertapp.py
Expand Up @@ -595,6 +595,9 @@ def initialize(self, argv=None):
def default_export_format(self):
return 'html'

class InvalidNotebook(Exception):
pass

#-----------------------------------------------------------------------------
# Main entry point
#-----------------------------------------------------------------------------
Expand Down