tvhong / incremental-reading

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

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

Closed mbindewald closed 1 year ago

mbindewald commented 1 year ago

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):

Additional context

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 https://github.com/tvhong/incremental-reading/issues/21 ?

tvhong commented 1 year ago

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 1 year ago

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