goerz / jupytext.vim

Vim plugin for editing Jupyter ipynb files via jupytext

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to delete temp files on Windows

i-d-lytvynenko opened this issue · comments

When closing .ipynb files on Win 10, the plugin fails to delete the generated .md files. You can see the redacted log below:

DBG: filename: C:\path\to\file.ipynb
DBG: filename exists: 1
DBG: jupytext_file: C:\path\to\file.md
DBG: jupytext_file exists: 0
DBG: Generate file C:\path\to\file.md
DBG: cmd: jupytext --to=md --output="C:\path\to\file.md" "C:\path\to\file.ipynb"
DBG: [jupytext] Reading C:\path\to\file.ipynb in format ipynb^@[jupytext] Writing 'C:\path\to\file.md'
DBG: read C:\path\to\file.md
DBG: autocmd jupytext_ipynb BufUnload <buffer> call s:cleanup("C:\path\to\file.md", 1)
DBG: autocmd jupytext_ipynb BufWriteCmd,FileWriteCmd <buffer> call s:write_to_ipynb()
DBG: filetype: markdown
DBG: a:jupytext_file:C:pathtofile.md
DBG: deleting C:pathtofile.md

This happens because of the double quotes in s:cleanup("C:\path\to\file.md", 1): backslash is treated as an escape symbol. If there is no particular reason to use double quotes instead of single ones, changing 2 lines of code will solve the problem (at least it did for me).