Jupytext: KeyError: 'execution_count'

Created on 18 Sep 2018  路  4Comments  路  Source: mwouts/jupytext

Attached minimal Jupyter notebook (strip ".txt"), given the following two commands, applied in series, results in the following error:

$ jupytext --to py error\ example2.ipynb
$ jupytext --test --update --to ipynb error\ example2.py

Traceback (most recent call last):
  File "/home/user/testing/venv/bin/jupytext", line 11, in <module>
    sys.exit(jupytext())
  File "/home/user/testing/venv/lib/python3.5/site-packages/jupytext/cli.py", line 129, in jupytext
    preserve_outputs=args.update)
  File "/home/user/testing/venv/lib/python3.5/site-packages/jupytext/cli.py", line 38, in convert_notebook_files
    test_round_trip_conversion(notebook, ext, preserve_outputs)
  File "/home/user/testing/venv/lib/python3.5/site-packages/jupytext/compare.py", line 88, in test_round_trip_conversion
    test_outputs=True)
  File "/home/user/testing/venv/lib/python3.5/site-packages/jupytext/compare.py", line 65, in compare_notebooks
    ref_cell = filtered_cell(ref_cell, preserve_outputs=test_outputs)
  File "/home/user/testing/venv/lib/python3.5/site-packages/jupytext/compare.py", line 16, in filtered_cell
    filtered['execution_count'] = cell['execution_count']
KeyError: 'execution_count'

error example2.ipynb.txt

Jupytext 0.6.5

Most helpful comment

The fix is on branch v0.7.0, but that branch is not stable yet, so I do not recommend that you use it now. Please wait a few more days before I can release it... Thanks

All 4 comments

Thanks @kernc for reporting this. This is very useful. Let me try to turn your example into an additional test...

The fix is on branch v0.7.0, but that branch is not stable yet, so I do not recommend that you use it now. Please wait a few more days before I can release it... Thanks

A prerelease is available. Try it with:

pip install jupytext==0.7.0rc0

Verified works great. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mwouts picture mwouts  路  10Comments

danieltomasz picture danieltomasz  路  3Comments

mwouts picture mwouts  路  7Comments

LukasMasuch picture LukasMasuch  路  4Comments

jhelie picture jhelie  路  6Comments