Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Anki v23.10 (incl. fix/workaround) #3

Open
Heart1010 opened this issue Nov 7, 2023 · 1 comment
Open

Error with Anki v23.10 (incl. fix/workaround) #3

Heart1010 opened this issue Nov 7, 2023 · 1 comment

Comments

@Heart1010
Copy link

Heart1010 commented Nov 7, 2023

After the v23.10 update the add-on doesn't work anymore.

Anki 23.10 (51a10f09) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: Windows-10-10.0.19045
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-11-07 10:11:33

When loading Reset Card Scheduling:
Traceback (most recent call last):
  File "aqt.addons", line 244, in loadAddons
  File "C:\Users\username\AppData\Roaming\Anki2\addons21\300884351\__init__.py", line 15, in <module>
    from . import main
  File "C:\Users\username\AppData\Roaming\Anki2\addons21\300884351\main.py", line 21, in <module>
    from .consts import anki21
  File "C:\Users\username\AppData\Roaming\Anki2\addons21\300884351\consts.py", line 22, in <module>
    addon_path = os.path.dirname(__file__).decode(sys_encoding)
AttributeError: 'str' object has no attribute 'decode'

A user mentioned in a review to change the following line

addon_path = os.path.dirname(__file__).decode(sys_encoding)

to

image
https://ankiweb.net/shared/info/300884351

In Python 2, string objects expose a decode() function. In Python 3, however, you don't have to decode your strings they're stored in Unicode.

The new way to check versions - see https://forums.ankiweb.net/t/porting-tips-for-anki-23-10/35916

image

@fuchsmd
Copy link

fuchsmd commented Dec 29, 2023

As changing line 22 results in an if-statement with two equal outcomes, I took the liberty of rewriting the consts.py and opening a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants