jcklie / anki-maobi

máobĭ (毛笔) is an Anki add-on to create cards with writing quizzes for Hanzi (Chinese characters)
MIT License
47 stars 7 forks source link

Configure decks and note types gives error messages #36

Closed hajelo closed 4 years ago

hajelo commented 4 years ago

Describe the bug When I open the card type screen or click the maobi button in the card type screen Anki gives me an error message, asking me to turn off add-ons and identify which one is causing the problem. I determined it was maobi, since I don't get the error message on entering the card type screen when maobi is disabled. I tried disabling all my other add-ons to see if it was a compatibility issue between one of them, but it still gave me the error. I opened JCK maobi note type to see if it had the error too. It does not show the error message on opening card type screen, but if I click the maobi button, it gives the error.

Other things I've tried:

  1. Using the example deck you provide. This works fine in learn/study mode
  2. Adding to the example deck. This also works. This fails. The writing box never appears. It's as if the add-on doesn't exist.
  3. Doing a custom study from the example deck. This fails the same as 2.

To Reproduce Steps to reproduce the behavior:

  1. Clone the JCK maobi note type
  2. open the card screen

or

  1. Open the JCK maobi card type screen
  2. Click the maobi button

Error message This is the error message that Anki gives: Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site. Debug info: Anki 2.1.31 (13476503) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1 Platform: Windows 10 Flags: frz=True ao=True sv=1 Add-ons, last update check: 2020-08-28 16:22:48

Caught exception: Traceback (most recent call last): File "aqt\progress.py", line 43, in handler File "aqt\clayout.py", line 468, in _renderPreview File "aqt\gui_hooks.py", line 789, in call File "C:\Users\Hannah\AppData\Roaming\Anki2\addons21\931477147\quiz.py", line 101, in maobi_hook template_name = card.template()["name"] File "anki\cards.py", line 155, in template File "anki\cards.py", line 146, in note_type File "anki\cards.py", line 142, in note File "anki\collection.py", line 309, in getNote File "anki\notes.py", line 37, in init TypeError: 'NoneType' object is not subscriptable

arueckle commented 4 years ago

I can verify this also happens on OSX with Anki 2.1.32 when any card is opened for editing (even unrelated card types)

jcklie commented 4 years ago

It looks like it is a bug in Anki itself, I opened a ticket in the Anki Forum for that. I will keep you updated. I can push an update that disables Maobi in the preview if you want but it looks like I cannot fix this erro by myself, it needs to be fixed in Anki. I try my best to get a workaround in maobi though.

jcklie commented 4 years ago

@hajelo Should be fixed on AnkiWeb, please have a try.

hajelo commented 4 years ago

The error is fixed! Thank you!