`nbterm` breaks with error `KeyError: 'name'`
christinahedges opened this issue · 2 comments
I'm trying to run notebooks using nbterm
to demonstrate my package, which I'm building using poetry
. I'd ideally like to have the notebooks run in sequence, and then the resulting executed notebooks be placed in a docs path.
I think I can achieve this using
poetry run nbterm --save-path ../docs/notebooks/test.ipynb --run HD209458.ipynb
But when I try this I get an error message that I find a little hard to debug. I'm opening this issue incase anyone runs into the same problem.
Traceback (most recent call last):
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/bin/nbterm", line 8, in <module>
sys.exit(cli())
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/nbterm.py", line 85, in cli
typer.run(main)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/typer/main.py", line 859, in run
app()
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
return get_command(self)(*args, **kwargs)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/typer/main.py", line 497, in wrapper
return callback(**use_params) # type: ignore
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/nbterm.py", line 73, in main
asyncio.run(nb.run_all())
File "/Users/ch/.pyenv/versions/3.8.7/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/ch/.pyenv/versions/3.8.7/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/notebook.py", line 120, in run_all
await self.run_cell(i)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/notebook.py", line 115, in run_cell
await self.current_cell.run()
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/cell.py", line 233, in run
await self.notebook.kd.execute(
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/kernel_driver/driver.py", line 195, in execute
_output_hook_default(msg)
File "/Users/ch/Library/Caches/pypoetry/virtualenvs/ombre-vf38qw1p-py3.8/lib/python3.8/site-packages/nbterm/notebook.py", line 352, in output_hook
if (not outputs) or (outputs[-1]["name"] != content["name"]):
KeyError: 'name'
Thanks for opening an issue.
It would be nice to have access to this notebook you're trying to run, in order to be able to reproduce.
Otherwise, the official way to run notebooks is still https://github.com/jupyter/nbclient, maybe you want to try it.
Thanks for the response! I think you're right that I'm better off using nbclient
. I tried to make a MWE for this error but I can't seem to, and the notebook i'm using is pretty bloated. I'll close for now seeing as there are other options to do what I want, and it's a hard error to reproduce