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

Traceback: Missing output fields from running code: {'image/svg+xml'} #138

Open
nikokaoja opened this issue Mar 4, 2020 · 1 comment
Open

Comments

@nikokaoja
Copy link

Hi there,

I encountered failed tests of my notebook for cells that produce plots.
I have been getting an error:

Traceback: Missing output fields from running code: {'image/svg+xml'}

What is the best way to avoid this type of errors ?

@ryan-williams
Copy link

Seems like your notebook file has an image/svg+xml output that is not showing up when nbval runs the notebook.

In my case it was:

Traceback: Missing output fields from running code: {'stderr'}

because a pair of stderr.write calls in one cell were ending up as separate outputs when run via Papermill, but were merged into one output when run interactively or via py.test --nbval.

Here's the place where the message originates:

nbval/nbval/plugin.py

Lines 479 to 486 in d7bc348

if ref_keys - test_keys:
self.comparison_traceback.append(
cc.FAIL
+ "Missing output fields from running code: %s"
% (ref_keys - test_keys)
+ cc.ENDC
)
return False

It is triggered when the re-run cell's outputs don't match the notebook file on disk.

The pytest/nbval output specifices which code cell index the error occurred at. Here's an easy way to inspect a given cell (including outputs / metadata):

cell_idx=6
jq '[.cells[] | select(.cell_type == "code")]'"[$cell_idx]" notebook.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants