Arthur-Milchior / anki-copy-note

An add-on to copy anki's note
GNU General Public License v3.0
23 stars 9 forks source link

Cards containing more than 11 fileds won't be copied. #41

Closed hsseek closed 2 years ago

hsseek commented 2 years ago

It seems that the addon cannot copy cards which contains more than 11 fields. Here's the error report.

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.48 (fb07bad3) 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-10-13 13:44:00 Add-ons possibly involved: ⁨Copy notes⁩

Caught exception: Traceback (most recent call last): File "/home/[userName]/.local/share/Anki2/addons21/1566928056/copyNote.py", line 67, in a.triggered.connect(lambda: copyNotes(browser)) File "/home/[userName]/.local/share/Anki2/addons21/1566928056/copyNote.py", line 54, in copyNotes copyNote(nid) File "/home/[userName]/.local/share/Anki2/addons21/1566928056/copyNote.py", line 78, in copyNote new_note, new_cards = add_note_with_id(note, nid if getUserOption("Preserve creation time", True) else None) File "/home/[userName]/.local/share/Anki2/addons21/1566928056/new_note_id.py", line 10, in add_note_with_id mw.col.add_note(note, 1) File "anki/collection.py", line 373, in add_note File "anki/_backend/generated.py", line 303, in add_note File "anki/_backend/init.py", line 131, in _run_command anki.errors.InvalidInput: Invalid input: ⁨note has 13 fields, expected 11⁩

ijgnd commented 2 years ago

I think this is a version of https://github.com/Arthur-Milchior/anki-copy-note/issues/38. I made the changes to .45+ and introduced this bug. Could you try the changes I have in my fork as a pull request https://github.com/Arthur-Milchior/anki-copy-note/pull/37 which consists of basically adding two lines, see https://github.com/Arthur-Milchior/anki-copy-note/pull/37/commits/66d00fab2a75bdcb73779b7a5c624c4ddb299d0a and https://github.com/Arthur-Milchior/anki-copy-note/pull/37/commits/b5894ec9e528a38988e5b04f0bbc4d8a9e72cc29.

hsseek commented 2 years ago

https://github.com/Arthur-Milchior/anki-copy-note/commit/b5894ec9e528a38988e5b04f0bbc4d8a9e72cc29 solved the issue.