LaTeX-Note-Importer-for-Anki icon indicating copy to clipboard operation
LaTeX-Note-Importer-for-Anki copied to clipboard

Traceback on import

Open langston-barrett opened this issue 7 years ago • 3 comments

Hi, I'm getting the following traceback:


Import failed. Debugging info:
Traceback (most recent call last):
  File "/nix/store/j2lcps7zkkm558r1v27mj3xx27wclijx-anki-2.0.36/lib/python2.7/site-packages/aqt/importing.py", line 294, in importFile
    importer.open()
  File "/home/siddharthist/Documents/Anki/addons/latexbiport/lateximport.py", line 56, in open
    self.cacheFile()
  File "/home/siddharthist/Documents/Anki/addons/latexbiport/lateximport.py", line 62, in cacheFile
    self.openFile()
  File "/home/siddharthist/Documents/Anki/addons/latexbiport/lateximport.py", line 68, in openFile
    self.processFile(unicode(self.fileobj.read(), "utf-8"))
  File "/home/siddharthist/Documents/Anki/addons/latexbiport/lateximport.py", line 207, in processFile
    self.preamble, document, ci = pieces[0]
IndexError: list index out of range

on the following .tex file: https://pastebin.com/raw/E27DJAmv

Any ideas why?

langston-barrett avatar Sep 08 '17 05:09 langston-barrett

Ah, it's because I didn't have a

\documentclass{article}
\begin{document}

at the beginning nor a

\end{document}

at the end. Perhaps there's a better way to notify the user of their silly mistake?

langston-barrett avatar Sep 08 '17 05:09 langston-barrett

Yes, there probably are better ways of notifying the user. On the other hand, there's probably more than one possible cause for this error. For example, what happens if you only have

\documentclass{article}
\begin{document}
\end{document

in your document with nothing in between? Plan:

(1) Find out all possible causes of this error. (2) Catch the bug. (3) Write up a helpful error message.

Unfortunately, I don't have any time to put this plan into action right now …

TentativeConvert avatar Sep 08 '17 08:09 TentativeConvert

Should be fixed in the 2.1-version by 05584daf839344406b00a0d50c82bf421795e45f. Waiting for user feedback before deploying this via Ankis website. See https://github.com/TentativeConvert/LaTeX-Note-Importer-for-Anki/issues/8#issuecomment-787076500.

TentativeConvert avatar Feb 27 '21 13:02 TentativeConvert