tvhong/incremental-reading

Closing Anki with plugin enabled error: AttributeError: 'AnkiQt' object has no attribute 'customMenus'

Closed this issue · 2 comments

Describe the bug
Closing Anki with incremental reading plugin enabled gives an error message.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Incremental Reading v4116 unofficial clone add on
  2. Restart Anki
  3. Close Anki or attempt to switch to a different profile

Expected behavior
Anki to close without errors

Logs / Screenshots

Debug info:
Anki 2.1.62 (77dd1dc1) Python 3.9.15 Qt 6.4.3 PyQt 6.4.0
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-05-01 11:22:22

Caught exception:
Traceback (most recent call last):
  File "aqt.main", line 1156, in closeEvent
  File "aqt.main", line 535, in unloadProfileAndExit
  File "aqt.main", line 510, in unloadProfile
  File "_aqt.hooks", line 3844, in __call__
  File "anki.hooks", line 34, in runHook
  File "C:\Users\matth\AppData\Roaming\Anki2\addons21\999215520\settings.py", line 201, in _unload
    for menu in mw.customMenus.values():
AttributeError: 'AnkiQt' object has no attribute 'customMenus'

image

Specs (please complete the following information):

  • OS: Windows 11 Home 22621.1635
  • Anki Version: Same issue on 2.1.61 and 2.1.62
  • Incremental Reading Version: 4.11.6 (latest)

Additional context

  • Issue occurs on a freshly created profile with ONLY this add on enabled.
  • There are other add ons installed on the system that have generated card types etc in this profile, here's a list of installed add ons:
    image
  • Check database and check media actions indicate no errors

I haven't had time to dig into source code yet / haven't dug in to anything Anki related before but I'm happy to help investigate and provide any information, just let me know!

Maybe related to #21 ?

tvhong commented

Hi,
Thanks for reporting the issue and even offering to help!

This issue does look like it comes from Incremental Reading code https://github.com/tvhong/incremental-reading/blob/main/ir/settings.py#L201 .

I think your suspicion is grounded. This might have been the symptom of another issue.

I won't have time to look into this in the next couple of weeks. So if you're interested in contributing, please take a look at https://github.com/tvhong/incremental-reading/blob/main/CONTRIBUTING.md . It's written for Unix and a few things are broken on Windows, but it should be mostly applicable.

tvhong commented

I was able to reproduce. Confirm that this is caused by #21 .