jdlorimer / incremental-reading

Anki add-on providing incremental reading features
https://ankiweb.net/shared/info/935264945
ISC License
218 stars 38 forks source link

UnicodeDecodeError when trying to open Options menu #20

Closed SebastianGG closed 7 years ago

SebastianGG commented 7 years ago

Hi Luoliyan.

When I try to open the "Options" menu, I get an error and nothing is displayed

I found the legacy version of the addon and tried it, but I still get an error:


Traceback (most recent call last): File "C:\Users\Sebasti�n\AppData\Roaming\Anki2\addons\ir\settings.py", line 132, in showDialog tabWidget.addTab(self.createHighlightingTab(), 'Highlighting') File "C:\Users\Sebasti�n\AppData\Roaming\Anki2\addons\ir\settings.py", line 309, in createHighlightingTab colorsGroupBox = self.createColorsGroupBox() File "C:\Users\Sebasti�n\AppData\Roaming\Anki2\addons\ir\settings.py", line 357, in createColorsGroupBox colors = self.getColorList() File "C:\Users\Sebasti�n\AppData\Roaming\Anki2\addons\ir\settings.py", line 415, in getColorList moduleDir = moduleDir.decode('utf-8') File "encodings\utf_8.py", line 16, in decode UnicodeDecodeError: 'utf8' codec can't decode byte 0xe1 in position 16: invalid continuation byte


Thanks in advance.

jdlorimer commented 7 years ago

I think you have installed the add-on via Anki, because it doesn't look like you have the latest version. Try a manual install of the legacy version (zip file) and let me know if you have any luck.

SebastianGG commented 7 years ago

I installed it originally from Anki, then tried the zip you linked, and I still get the same behavior. Both are version 3.6.10, are they exactly the same?

I'm usin Anki 2.0.47 and Windows 10.

I removed all other addons to see if there was any compatibility problem, but the result is still the same.

Btw, zooming doesn't work at all either.

jdlorimer commented 7 years ago

They are almost exactly the same, except for one line in settings.py.

Is the error the same? This line of code: moduleDir = moduleDir.decode('utf-8') doesn't exist in the current version, so it shouldn't appear in the error message either.

SebastianGG commented 7 years ago

I don't know what silly mistake I must have made, but now the addon is working, with the zip you provided.

So, the only difference between the original version and the corrected one is this line in the settings.py file?

Original version > 415 moduleDir = moduleDir.decode('utf-8')

Corrected version > 415 moduleDir = moduleDir.decode(getfilesystemencoding())

Thanks for your help!

jdlorimer commented 7 years ago

Yes, that's correct. The European character in your username wasn't being handled correctly. It was just that one line causing the error.