Arthur-Milchior / anki-enhanced-cloze

GNU General Public License v3.0
2 stars 1 forks source link

anki-enhanced-cloze: error in the editor #1

Closed BaekToDaFuture closed 5 years ago

BaekToDaFuture commented 5 years ago

Hello, Thank you for the update and sharing. I am getting the following error with the add-on installed when I try to add clozes in the editor however:

Debug info: Anki 2.1.13 (3ba55990) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Mac 10.14.5 Flags: frz=True ao=True sv=1 Add-ons possibly involved: cloze_overlapper

Caught exception: File "aqt/editor.py", line 216, in checkFocus File "", line 2, in onCloze File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 71, in repl File "/Users/---/Library/Application Support/Anki2/addons21/cloze_overlapper/editor.py", line 191, in onInsertCloze return _old(self) File "aqt/editor.py", line 485, in onCloze File "", line 2, in on_save_now File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 68, in repl <class 'TypeError'>: onEditorSave() got an unexpected keyword argument 'keepFocus'

I've always felt somewhat uneasy about not contributing to projects. I will look into Patreon page. Thanks again.

Note: Cloze(Hide all) generates the same bug report as well.

Arthur-Milchior commented 5 years ago

Hi,

I'm sorry; I have trouble understanding your bug report. In particular, I don't understand what does the «edit» means, and why did you copy paste the same error message twice.

Arthur-Milchior commented 5 years ago

I don't use cloze_overlapper. I'll get a look at it later. It is entirely possible that both add-ons are incompatible. As @glutanimate does not list the methods its code change, I'll have to take a look at his code to check what seems wrong)

glutanimate commented 5 years ago

Cloze Overlapper appears in the error message because it wraps onCloze, but the issue is downstream from that in – what I assume – is a file belonging to Cloze (Hide all) (I can't be sure which add-on it belongs to because for whatever reason the error message does not include the file name, it just says File "").

In any case, the problem lies with whatever add-on implements onEditorSave.

glutanimate commented 5 years ago

Yep, looks like the issue is with Cloze Hide All: https://github.com/Arthur-Milchior/anki_plugins/blob/master/cloze_hide_all/cloze_hide_all21.py#L411-L420

The method signature of Editor.saveNow has changed in recent 2.1 releases, so you'll have to account for that when wrapping it: https://github.com/dae/anki/commit/46a540e22f50101e88b56af1f701176e788ca217 Staying up to date with changes like that is one of the more annoying parts of AnkI's add-on ecosystem, unfortunately.

Still, it's curious that the error would only appear after installing Enhanced Cloze.

BaekToDaFuture commented 5 years ago

I should have been more clear. It's hard to see which points that I need to point out, as I am not a developer. I was merely trying to be more helpful. I hope you don't mind. (I have some sense of reading code, so I like to see what goes on on github and learn from bits of code here and there. Especially with Anki add-ons in hopes to contribute someday, but have yet to look at the Anki documentation, hence my lack of clarity on what I posted.)

As for the edit you can leave that out completely. It's "etiquette" from Reddit I picked up, which I wasn't sure whether it should be used here.

As for the two error messages. after the edit, I mention Your fork for add-on: Cloze Hide All They seemed to generate same bug report, so I pasted it twice. In case It would be useful (somehow?) and as glutanimate pointed out, the error occurred even before I installed Enhanced Cloze.

I'm guessing from my own observations on Reddit and Anki forum, but I think _ClozeOverlapper is a popular add-on, so if it is a problem between the two add-ons, I may not be the only one to see this error in the future.

Arthur-Milchior commented 5 years ago

No trouble, you're not supposed to be a developper to make a bug report. That's why we can discuss about you, to let you know what we need to know.

Thank you for explaining that the error occurred even before installing this add-on. This makes more sens now.

How did you install «Cloze hide all», I can't find it on anki 2.1. It seems I did fork it but never put it on ankiweb, nor did I make a pull request; I've now clue why I would ever did that.

Arthur-Milchior commented 5 years ago

https://github.com/phu54321/anki_plugins/pull/10 I did the pull request, and I edited the file to ensure that they «Hide (cloze all)» is compatible

BaekToDaFuture commented 5 years ago

No trouble, you're not supposed to be a developper to make a bug report. That's why we can discuss about you, to let you know what we need to know.

Thank you for explaining that the error occurred even before installing this add-on. This makes more sens now.

How did you install «Cloze hide all», I can't find it on anki 2.1. It seems I did fork it but never put it on ankiweb, nor did I make a pull request; I've now clue why I would ever did tha

I was looking at the original code for 2.0 and was wondering if it was going to be updated for 2.1. Then I saw fork you made, recognized you username and tried it out.