vim-jukit icon indicating copy to clipboard operation
vim-jukit copied to clipboard

Error when opening a notebook with spaces

Open sulan opened this issue 1 year ago • 2 comments

Hi,

When opening a notebook with spaces in the filename, I get the following error:

"file with spaces.ipynb" 60L, 1359B written
Error detected while processing function jukit#convert#notebook_convert[5]..<SNR>123_convert_to_script[12]..provider#python3#Call:
line   18:
Error invoking 'python_execute' on channel 5 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/home/sulan/.local/share/nvim/site/pack/packer/start/vim-jukit/helpers/ipynb_convert/convert.py", line 123, in convert
    language, nb = get_nb_and_language(nb, lang)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sulan/.local/share/nvim/site/pack/packer/start/vim-jukit/helpers/ipynb_convert/util.py", line 11, in get_nb_and_language
    assert nb["nbformat"] > 3, (
           ~~^^^^^^^^^^^^
KeyError: 'nbformat'

It seems to come from nvim reporting the filename with \s in it, after which the python code (in load_json in utils.py) tries to load the wrong filename, and returns an empty dict.

Versions

  • NVIM v0.9.0
  • Python 3.11.3
  • Linux 6.3.3-arch1-1

sulan avatar May 26 '23 12:05 sulan