Closed ijgnd closed 1 year ago
Thanks very much for the clear report!
I can indeed reproduce the issue when I install Enhanced Cloze (for Anki 2.1), but not otherwise.
I'll look into this.
From a cursory glance, it seems that something is (re)defined to be recursive in the collection models. For instance, testing the following in the Anki debug console (Ctrl-Shift-:
), with just Enhanced cloze enabled, I get the same crash:
print(mw.col.models)
(The crash doesn't occur if Enhanced cloze is disabled.)
Obviously, though, given that it's us (CrowdAnki) who are trying to serialise the object, we should avoid crashing under these circumstances. :)
(AFAICT the issue is caused by Enhanced cloze's compat.add_compatibility_alias
which AFAICT adds by_name
, field_names
and field_map
as keys of the model object, rather than as methods of the model object. (It also calls the compat code when it's not actually needed, due to checking in __dict__
.)) I'll see how we can work around this.
While I try to work out the correct approach from the side of CrowdAnki (unfortunately I probably won't have any more time to further investigate (at least I now understand what's going wrong), this week or next (sorry!) :() you can work around the issue (without disabling either add-on) by patching the Enhanced cloze compat code:
def add_compatibility_alias(namespace, new_name, old_name):
if new_name not in list(dir(namespace)):
setattr(namespace, new_name, getattr(namespace, old_name))
return True
return False
Thanks for this very quick fix.
I posted https://github.com/RisingOrange/anki-enhanced-cloze/issues/54 to notify RisingOrange about the problem you found in his add-on.
I posted https://github.com/RisingOrange/anki-enhanced-cloze/issues/54 to notify RisingOrange about the problem you found in his add-on.
Thanks for posting!
fixed in Enhanced cloze with commit https://github.com/RisingOrange/anki-enhanced-cloze/commit/0cee285668997f70e3bdb50141f424a4e67249af
Maybe this is the same as #172.
I tried with Anki 2.1.49 in linux and Anki 2.1.54 in Windows. On both systems I have just two add-ons installed: CrowdAnki and Enhanced Cloze (for Anki 2.1).
If the add-on "Enhanced Cloze" is disabled I get no error message.
If the add-on "Enhanced Cloze" is enabled when in the main window I click File -> "CrowdAnki: Snapshot" I get the following error message (in windows the error message is similar):