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

Add-on Startup Failed on Anki 23.10 #9

Closed
GBergatto opened this issue Dec 23, 2023 · 3 comments
Closed

Add-on Startup Failed on Anki 23.10 #9

GBergatto opened this issue Dec 23, 2023 · 3 comments

Comments

@GBergatto
Copy link

When trying to run this add-on on Anki 23.10.1, I get the following error message:

Anki 23.10.1 (fac9e0e) Python 3.11.6 Qt 6.6.1 PyQt 6.6.1
Platform: Linux-6.6.7-arch1-1-x86_64-with-glibc2.38
Flags: frz=False ao=True sv=3
Add-ons, last update check: 2023-12-23 08:19:36

When loading Write on your screen:
Traceback (most recent call last):
  File "/home/gb/.local/share/Anki2/addons21/567651868/__init__.py", line 481, in ts_setup_menu
    mw.addon_view_menu
AttributeError: 'AnkiQt' object has no attribute 'addon_view_menu'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/aqt/addons.py", line 245, in loadAddons
    __import__(addon.dir_name)
  File "/home/gb/.local/share/Anki2/addons21/567651868/__init__.py", line 519, in <module>
    ts_onload()
  File "/home/gb/.local/share/Anki2/addons21/567651868/__init__.py", line 183, in ts_onload
    ts_setup_menu()
  File "/home/gb/.local/share/Anki2/addons21/567651868/__init__.py", line 483, in ts_setup_menu
    mw.addon_view_menu = QMenu(_(u"&View"), mw)
                         ^^^^^^^^^^^^^^^^^^^^^^
TypeError: arguments did not match any overloaded call:
  QMenu(parent: Optional[QWidget] = None): argument 1 has unexpected type 'str'
  QMenu(title: Optional[str], parent: Optional[QWidget] = None): argument 2 has unexpected type 'AnkiQt'

I've opened the same issue on the orginal repo, and I've provided a fix in a PR by changing all imports to use aqt.qt.
I hope this helps.

@LeoWang2007
Copy link
Owner

I have fixed it. Now it can be run in the anki version 23.12.1, I think anki version 23.10.1 can run correctly too. If it also have something wrong, please tell me.

@LeoWang2007
Copy link
Owner

You can get it with addon code: 567651868 directly in anki.
Sorry for the wait.

@GBergatto
Copy link
Author

Thanks for the fix. I can confirm that it runs on Anki 23.12.1. I also appreciate the fact that you you have published the code as well.

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