Hello,
I’m not great with code, and I’m not sure how to deal with this error. I appreciate any help anyone can offer.
I am versioning the Spanish Flash Card mode to Klingon phrases. The mode runs fine, but it does display an error in the info screen after a little while running. I’d like to understand the issue and fix it before sharing the mode.
To make this mode, I did 3 things:
- I made a version of the wordlist with Klingon words & phrases, “klingon.py”
- I changed the variable named “spanish_words” to “klingon_words” and updated the references to the wordlist
- I switched word1 and word2, so Klingon will display first, then English.
I’m getting this error after the mode has been running a little bit:
Traceback (most recent call last):
File “main.py”, line 203, in
mode.draw(screen,etc)
File “/usbdrive/Modes/T - Klingon Flash Cards/main.py”, line 36, in draw
word2 = unicode(words[word_index][1])
IndexError: list index out of range![KlingonModeError|666x500]
I’m attaching a jpg of the error in case I transcribed wrong.
Here is the mode: Klingon Flash Cards | Patchstorage
The Klingon phrase list is much shorter than the original Spanish one, it’s only 60 lines long. My guess is that the index out of range might have to do with this length. But, as far as I can see, the index in the code is pulled from the length of the wordlist. (I could be wrong, of course, I know just enough about code to be dangerous.)
Can anyone help me understand what is going on here?
Thank you.