I was running into an issue on 2.1.38 when trying to copy a note
Caught exception:
Traceback (most recent call last):
File "/Users/garrett2/Library/Application Support/Anki2/addons21/1566928056/copyNote.py", line 65, in <lambda>
a.triggered.connect(lambda: copyNotes(browser.selectedNotes()))
File "/Users/garrett2/Library/Application Support/Anki2/addons21/1566928056/copyNote.py", line 52, in copyNotes
copyNote(nid)
File "/Users/garrett2/Library/Application Support/Anki2/addons21/1566928056/copyNote.py", line 83, in copyNote
note.flush()
File "anki/notes.py", line 68, in flush
File "anki/rsbackend_gen.py", line 364, in update_note
File "anki/rsbackend.py", line 256, in _run_command
The solution was to use addNote instead. I also had to set the id to 0 first because of a rust assertion.
Keep in mind, addNote in collection.py is legacy and likely to break again. add_note should be used instead, but it requires you to provide a deck_id and this PR only contains the code changes that I was able to get working on my machine.
This is a fix for #20 and possible #19
I was running into an issue on 2.1.38 when trying to copy a note
I drilled down and found the source of the issue was some newly added error handling. See this issue for more details.
The solution was to use
addNote
instead. I also had to set the id to 0 first because of a rust assertion.Keep in mind,
addNote
incollection.py
is legacy and likely to break again.add_note
should be used instead, but it requires you to provide adeck_id
and this PR only contains the code changes that I was able to get working on my machine.