anki-connect icon indicating copy to clipboard operation
anki-connect copied to clipboard

Bug: guiEditNote returns error ('Edit' object has no attribute 'finished')

Open Xydez opened this issue 1 year ago • 3 comments

Opening the editor for a note does not work.

$ curl "localhost:8765" -X POST -d "{\"action\": \"guiEditNote\", \"version\": 6, \"params\": { \"note\": 1703190736523 } }"
{"result": null, "error": "'Edit' object has no attribute 'finished'"}

Any clue what this is and how to fix it?

Thank you so much for this project!

Platform: Windows Anki version: 23.10.1 (Python 3.9.15 Qt 6.6.0 PyQt 6.6.0) AnkiConnect version: 2023-10-29

Xydez avatar Dec 21 '23 21:12 Xydez

Having the same problem... https://github.com/themoeway/yomitan/issues/417

krischimk avatar Dec 21 '23 23:12 krischimk

Yeah, this looks like some issue with 23.10.1 of Anki.
Here is a traceback of the error:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Anki2\addons21\2055492159\edit.py", line 479, in open_dialog_and_show_note_with_id
    return aqt.dialogs.open(cls.dialog_registry_tag, note)
  File "aqt", line 136, in open
  File "C:\Users\user\AppData\Roaming\Anki2\addons21\2055492159\edit.py", line 211, in __init__
    aqt.mw.garbage_collect_on_dialog_finish(self)
  File "aqt.main", line 1749, in garbage_collect_on_dialog_finish
AttributeError: 'Edit' object has no attribute 'finished'

Just for fun, I've added finished = True to the plugins Edit class. While the traceback remains identical, the error message is now this:

AttributeError: 'bool' object has no attribute 'connect'

I've never developed plugins for Anki or used Qt in general, so I'm not sure how to proceed.

ThisIsntTheWay avatar Dec 22 '23 09:12 ThisIsntTheWay

This was probably caused by https://github.com/ankitects/anki/commit/115f2a425e0c572e0e45f53186cefe9cf9f80842.

As aqt.editcurrent.EditCurrent no longer inherits from QDialog, the Edit class needs some changes to work with 23.10.

https://github.com/FooSoft/anki-connect/blob/1f7fc80b7e7f5ab904ba0e18fa657137d26936e8/plugin/edit.py#L181-L191

yibe avatar Dec 22 '23 20:12 yibe