anki-connect icon indicating copy to clipboard operation
anki-connect copied to clipboard

Error when changing note type in guiAddCard

Open bnpd opened this issue 4 years ago • 1 comments

When a note type is specified using AnkiConnect for guiAddCards and the end user then tries to change it using the Anki GUI, it will cause an error:

`Error Debug info: Anki 2.1.44 (b2b3275f) Python 3.8.1 Qt 5.15.1 PyQt 5.15.1 Platform: Linux Flags: frz=True ao=True sv=2 Add-ons, last update check: 2021-06-11 10:51:55

Caught exception: Traceback (most recent call last): File "aqt/webview.py", line 526, in handler File "aqt/editor.py", line 534, in File "aqt/modelchooser.py", line 98, in onModelChange File "aqt/hooks_gen.py", line 837, in call TypeError: onModelChange() takes 1 positional argument but 2 were given `

bnpd avatar Jun 12 '21 06:06 bnpd

I am also getting this error on Windows 10 with slightly different versions of Python, Qt and PyQt:

Debuginformationen: Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2 Platform: Windows 10 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2021-08-24 19:27:03 Caught exception: Traceback (most recent call last): File "aqt\modelchooser.py", line 98, in onModelChange File "aqt\hooks_gen.py", line 837, in call TypeError: onModelChange() takes 1 positional argument but 2 were given

I used this request and then changed the note type to Basic (and reversed card):

{ "action": "guiAddCards", "version": 6, "params": { "note": { "deckName": "Default", "modelName": "Basic", "fields": { "Front": "This is the question", "Back": "This is the answer" }, "options": { "closeAfterAdding": true }, "tags": [ "countries" ] } } }

enrico3 avatar Aug 24 '21 17:08 enrico3