grst / nbimporter

Import ipython notebooks as modules
BSD 3-Clause "New" or "Revised" License
59 stars 9 forks source link

"Cannot convert notebook to v5 because that version doesn't exist" with nbformat >= 5 #8

Closed datakurre closed 4 years ago

datakurre commented 4 years ago

nbimporter detects the latest nbformat version from the major version of nbformat package. Because nbformat 5.0.x does not introduce format version 5, importing fails.

ValueError: Cannot convert notebook to v5 because that version doesn't exist
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/nix/store/s87s9zbn4ddqphs2dxs57rhrdjnlb16n-python3.7-nbimporter-0.3.1/lib/python3.7/site-packages/nbimporter.py", line 75, in load_module
    nb = nbformat.read(f, nb_version)

Minimal patch would be to cap supported nbformat versions at 4 with min(nb_version, 5).

I realise that this package may not be maintained anymore, but wanted to add this issue here for those facing the same error.

tapanhp commented 4 years ago

Did anyone resolve this issue?