goerz / jupytext.vim

Vim plugin for editing Jupyter ipynb files via jupytext

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot open .ipynb without .md file

lace-wing opened this issue · comments

Symptom

While opening an .ipynb file, an error will occur:

Error detected while processing BufReadCmd Autocommands for "*.ipynb"..function <SNR>17_read_from_ipynb:                                              
line   24:
jupytext --to=md --output='/private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Personal/IBDP/BusinessManage
ment/IA/j_p.md' '/private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Personal/IBDP/BusinessManagement/IA/j_
p.ipynb': 1

However, if an .md file with the same name generated by Jupytext is there, the .ipynb file can be opened, changes made in the .ipynb file is synced to the .md file.

After pressing Enter to proceed, the file will seem to be empty (as conversion failed).

Jupytext itself works well. For-back conversions can be done correctly.

Reproduction

  1. Create an .ipynb file via Jupyter Lab/Notebook
  2. Open the file via Vim
  3. An error will occur as mentioned above

Specs

  • OS: Darwin 22.5.0/iPadOS 16.5
  • Arch: Arm64
  • Machine: iPad Pro 3
  • App: a-Shell, runs a Linux-like shell
  • Python: 3.11.0
  • Vim: 8.2
  • Anaconda: not installed
  • Pandoc: not installed

Debug Messages

Messages from :messages after let g:jupytext_print_debug_msgs = 1:

DBG: filename: /private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.ipynb                         
DBG: filename exists: 1
DBG: jupytext_file: /private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.md
DBG: jupytext_file exists: 0
DBG: Generate file /private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.md
DBG: cmd: jupytext --to=md --output='/private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.md' '/pr
ivate/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.ipynb'
DBG: pandoc: command not found^@[jupytext] Reading /private/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Documents/Loca
l/j_p.ipynb in format ipynb^@Traceback (most recent call last):^@  File "/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/
Library/bin/jupytext", line 8, in <module>^@    sys.exit(jupytext())^@             ^^^^^^^^^^^@  File "/var/mobile/Containers/Data/Application/6B7E2B9
2-E388-481D-8893-F1E3F0AAE8B8/Library/lib/python3.11/site-packages/jupytext/cli.py", line 488, in jupytext^@    exit_code += jupytext_single_file(nb_f
ile, args, log)^@                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^@  File "/var/mobile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1
E3F0AAE8B8/Library/lib/python3.11/site-packages/jupytext/cli.py", line 864, in jupytext_single_file^@    base_path(nb_dest, dest_fmt)^@  File "/var/mo
bile/Containers/Data/Application/6B7E2B92-E388-481D-8893-F1E3F0AAE8B8/Library/lib/python3.11/site-packages/jupytext/paired_paths.py", line 55, in base
_path^@    raise InconsistentPath(^@jupytext.paired_paths.InconsistentPath: Notebook path ''/private/var/mobile/Containers/Data/Application/6B7E2B92-E
388-481D-8893-F1E3F0AAE8B8/Documents/Local/j_p.md'' was expected to have extension '.md'^@