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

Doesn't work on latest to date Anki #42

Closed camerooncameroon closed 2 years ago

camerooncameroon commented 2 years ago

Hi, thanks for very useful addon! Sad enough, didn't work for me. Hope this would be of help to fix the issue: 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=3 Add-ons, last update check: 2021-11-21 12:00:59

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 6 fields, expected 15⁩

ijgnd commented 2 years ago

this looks pretty similar to #38 and #41.

the solution is to add two lines to the add-on, see https://github.com/Arthur-Milchior/anki-copy-note/issues/41#issuecomment-945017921.

I tried to add support for .45+ for this add-on and added this bug (which arthur merged and uploaded ...) - at least I noticed it early and made another pull request as #37.

omarkohl commented 2 years ago

I can confirm the error (albeit in my case it says "anki.errors.InvalidInput: Invalid input: ⁨note has 5 fields, expected 7", so it's probably note type specific) and also that the workaround from the previous comment works.

camerooncameroon commented 2 years ago

@ijgnd Thanks for the workaround! Just to make sure, Should be added:

two strings to new_note_id.py and one string to copyNote.py

Right?

UPD: need to replace one string in new_note_id.py and add one string to copyNote.py

After restart Anki everything works fine!

omarkohl commented 2 years ago

@camerooncameroon why did you close the issue? It hasn't been resolved. Manually editing some files is a workaround for some people at best, but not a real fix.