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

Version 2.1.49 New Issue - Cannot copy notes with more than 10 fields #43

Open ruby1898 opened 2 years ago

ruby1898 commented 2 years ago

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.49 (dc80804a) 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-11-26 12:49:28

Caught exception: Traceback (most recent call last): File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\1566928056\copyNote.py", line 67, in a.triggered.connect(lambda: copyNotes(browser)) File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\1566928056\copyNote.py", line 54, in copyNotes copyNote(nid) File "C:\Users\Asus\AppData\Roaming\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 "C:\Users\Asus\AppData\Roaming\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 20 fields, expected 10

sergio0p commented 2 years ago

I also encountered a similar error message:

Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2 Platform: Mac 10.16 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2021-12-14 13:31:22 Add-ons possibly involved: ⁨Copy notes⁩

Caught exception: Traceback (most recent call last): File "/Users/parreiras/Library/Application Support/Anki2/addons21/1566928056/copyNote.py", line 67, in a.triggered.connect(lambda: copyNotes(browser)) File "/Users/parreiras/Library/Application Support/Anki2/addons21/1566928056/copyNote.py", line 54, in copyNotes copyNote(nid) File "/Users/parreiras/Library/Application Support/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 "/Users/parreiras/Library/Application Support/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 20 fields, expected 12⁩

okerivy commented 2 years ago

Maybe this add-on requires add-ons that allow multiple add windows: Opening the same window multiple time.

soamsy commented 2 years ago

I tried to troubleshoot this for a bit, and I can get a note to copy, but only if the last note I added to one of my decks is the same note type as what I'm trying to copy. So if the last note I added to a deck had 20 fields, and I'm trying to copy a note with 10 fields, I'll get this error message.

soamsy commented 2 years ago

Update: using the code changes on the pull request in #37 fixes this for me.