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

Just work when the note has 2 fields(?) #38

Open gustavosmendes opened 3 years ago

gustavosmendes commented 3 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.47 (dc156f34) 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-09-21 12:39:51

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

@ijgnd

ijgnd commented 3 years ago

thanks for reporting this.

Could you change one word in one line as shown here in your text editor in the file new_note_id.py in the folder of this addon named "1566928056" in the addon21 folder: https://github.com/Arthur-Milchior/anki-copy-note/pull/37/commits/b5894ec9e528a38988e5b04f0bbc4d8a9e72cc29

after this restart anki and try again. Please also check if syncing works. Your testing and reports would help me a lot.

gustavosmendes commented 3 years ago

Sure. I'll test it right now.

gustavosmendes commented 3 years ago

Everything working perfectly, even synchronization. I tested the sync with ankidroid later.

ijgnd commented 3 years ago

I forgot. the syncing should break with the version from ankiweb because of my incomplete fixes from last week.

I have made another fix for this here: https://github.com/Arthur-Milchior/anki-copy-note/pull/37/commits/66d00fab2a75bdcb73779b7a5c624c4ddb299d0a This time you need to add one line into copyNote.py and then restart.

gustavosmendes commented 3 years ago

I'll add, but there is no error about syncing in ankiweb

ijgnd commented 3 years ago

maybe you just copied cards without reviews of have disabled the option to copy logs?

The second patch I mentioned 20 minutes ago fixes a problem that occurs when copying the review log.

Or maybe I miss something ...

gustavosmendes commented 3 years ago

Actually, I copied unrevised/new cards for testing. You're right.

ijgnd commented 3 years ago

Did you run into other problems with my version of the copy notes add-on? Does copying the log work?

gustavosmendes commented 3 years ago

No problems found. Synchronization works normally. Thank you!

demiaus commented 2 years ago

I forgot. the syncing should break with the version from ankiweb because of my incomplete fixes from last week.

I have made another fix for this here: 66d00fa This time you need to add one line into copyNote.py and then restart.

Does that fix the syncing error, or should I revert the change from b5894ec?

ijgnd commented 2 years ago

I meant to keep the change you already have from https://github.com/Arthur-Milchior/anki-copy-note/commit/b5894ec9e528a38988e5b04f0bbc4d8a9e72cc29 (which fixes the two field problem) and in addition to that add the line I added in https://github.com/Arthur-Milchior/anki-copy-note/commit/66d00fab2a75bdcb73779b7a5c624c4ddb299d0a (for fixing the syncing).