MFreidank / AnkiVim

Use vim (or your favorite editor) to write anki cards quickly in plain text or latex.
Other
204 stars 14 forks source link

All kinds of errors. #6

Closed qazip closed 5 years ago

qazip commented 5 years ago
anki-vim DECKNAME
/usr/bin/nano: invalid option -- ' '
Type '/usr/bin/nano -h' for a list of available options.
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.7/site-packages/ankivim/cards.py", line 146, in open_editor
    check_call(call_command)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/usr/bin/nano', '-c /\\v\\%\\n\\zs(^$|^[^\\%]{1}.*$)', '-c set filetype=anki_vim', '-c set syntax=tex', '-c let b:UltiSnipsSnippetDirectories=["UltiSnips", "/home/user/.local/lib/python3.7/site-packages/ankivim/UltiSnips"]', '/tmp/tmp2a_g6j66.anki_vim')' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/anki-vim", line 90, in <module>
    main()
  File "/home/user/.local/bin/anki-vim", line 84, in main
    while create_card(deckpath=deckpath, editor=editor, editor_args=editor_args):
  File "/home/user/.local/lib/python3.7/site-packages/ankivim/cards.py", line 213, in create_card
    filename=temporary_file.name, editor=editor, editor_args=editor_args
  File "/home/user/.local/lib/python3.7/site-packages/ankivim/cards.py", line 151, in open_editor
    editor=editor, filename=filename, call=" ".join(call_command)
ValueError: Failed to call editor '/usr/bin/nano' on filename '/tmp/tmp2a_g6j66.anki_vim'.
 Full call string was: /usr/bin/nano -c /\v\%\n\zs(^$|^[^\%]{1}.*$) -c set filetype=anki_vim -c set syntax=tex -c let b:UltiSnipsSnippetDirectories=["UltiSnips", "/home/user/.local/lib/python3.7/site-packages/ankivim/UltiSnips"] /tmp/tmp2a_g6j66.anki_vim

Is it a problem on my end somehow?

MFreidank commented 5 years ago

This should be fixed after #7, which should also render it unnecessary to pass empty --editor-args for neovim as I suggested in your closed issue #5. I believe this warrants a minor release to pypi to ensure non-vim users can benefit from these changes. Thanks a lot for helping me improve this interface!

MFreidank commented 5 years ago

Update: the pypi release is out, if you execute: pip install --upgrade ankivim it should pull the new version that should handle these cases much more gracefully. Thanks again, if you encounter any additional issue, feel free to open an issue again.