iamjustkoi / LeechToolkit

Toolkit for adding extra leech and lapse functionality to Anki.
MIT License
5 stars 1 forks source link

Error Message once in a while #4

Closed Ankilli closed 1 year ago

Ankilli commented 1 year ago

Bug/Issue Description As I review my cards an error message pops up as soon as I rate an card (happens about every 10th or so card)

To Reproduce don't know any other occasion than just reviewing..

Screenshots/Visuals Log pasted

System/Debug Info

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.14.1 PyQt 5.14.1
Platform: Mac 12.6.1
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2022-12-01 10:22:33

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AMBOSS add-on ['0amboss_addon', 2022-06-27T18:14, 'None', mod]
AnKing Note Types Easy Customization ['952691989', 2022-11-22T19:37, 'None', '']
Anki Simulator ['817108664', 2021-08-07T21:24, 'None', '']
Anki Zoom ['538879081', 2020-04-04T02:20, 'v1.1.3', '']
AnkiWebView Inspector ['31746032', 2022-04-08T21:44, 'None', '']
Asset Manager ['656021484', 2021-08-29T23:07, 'None', '']
BetterSearch ['1052724801', 2022-01-25T23:25, 'None', '']
Closet For Anki ['272311064', 2022-08-12T10:27, 'None', '']
Cloze Overlapper for Anki 21 ['109531687', 2021-01-12T04:12, 'None', '']
Copy notes ['1566928056', 2021-12-24T20:56, 'None', '']
Cross Profile Search and Import ['310394744', 2019-05-28T18:15, 'None', '']
Custom Background Image and Gear Icon ['1210908941', 2022-11-28T19:08, 'None', mod]
Customize Keyboard Shortcuts ['24411424', 2022-09-14T11:12, 'None', '']
Deadline2 ['723639202', 2021-05-02T06:45, 'None', mod]
Frozen Fields ['516643804', 2020-03-01T05:12, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
Leaderboard ['41708974', 2022-05-12T11:46, 'None', mod]
Learning Step and Review Interval Retention ['1949865265', 2022-08-28T22:21, 'None', '']
Leech Toolkit ['368380974', 2022-10-13T00:27, 'None', '']
Mini Format Pack ['295889520', 2018-07-24T19:45, 'None', '']
More Decks Stats and Time Left ['1556734708', 2022-10-09T14:05, 'None', mod]
Postpone cards review ['1152543397', 2021-02-13T17:47, 'None', '']
Refocus Card when Reviewing 21 ['1642550423', 2018-09-19T16:14, 'None', '']
Remaining time for Anki 21 ['1508357010', 2020-12-13T15:14, '20.12.13i151', mod]
Removes Empty Note Types for 21 ['530953383', 2019-06-12T16:11, 'None', '']
Reset Card Scheduling ['300884351', 2018-09-18T18:17, 'None', '']
Resize images in editor ['1103084694', 2021-07-19T08:35, 'None', mod]
Review Heatmap ['review_heatmap', 2020-04-30T15:23, 'None', '']
Set Card Ease ['1387847178', 2022-11-17T19:41, 'None', mod]
Special Fields ['1102281552', 2022-11-22T02:49, 'None', mod]
Speed Focus Mode auto-alert auto-reveal auto-fail ['1046608507', 2019-06-02T11:11, 'None', '']
Straight Reward ['957961234', 2022-03-31T21:37, 'None', '']
Symbols As You Type ['2040501954', 2022-06-08T06:09, 'None', '']
Transfer scheduling data from one card to another ['94685914', 2020-09-18T11:23, 'None', '']
True Retention by Card Maturity ['923360400', 2017-08-29T21:00, 'None', '']
Ze Add Note Id ['886709118', 2021-03-02T21:06, 'None', '']
ZzLegacy Spelling Police ['1410276506', 2020-03-03T03:13, 'None', mod]
autoLapseNewInterval  automatically adjust the new interval after a lapse ['372281481', 2022-09-28T09:26, 'None', mod]

===IDs of active AnkiWeb add-ons===
1046608507 1052724801 109531687 1102281552 1103084694 1152543397 1210908941 1374772155 1387847178 1410276506 1508357010 1556734708 1566928056 1642550423 1949865265 2040501954 24411424 272311064 295889520 300884351 310394744 31746032 368380974 372281481 41708974 516643804 530953383 538879081 656021484 723639202 817108664 886709118 923360400 94685914 952691989 957961234

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Advanced Review Bottom Bar ['1136455830', 2022-09-29T15:31, 'None', mod]
Auto Ease Factor ['1672712021', 2021-03-21T19:11, 'None', mod]
ImageResizer ['1214357311', 2022-07-15T15:05, 'None', '']
Legacy ReMemorize ['323586997', 2020-11-20T06:27, 'None', mod]
Speed Focus Mode ['speed_focus_mode', 2019-06-29T00:35, 'None', '']
True Retention ['613684242', 2017-11-19T21:43, 'None', '']

Additional Context Error Log: Fehler Es ist ein Fehler aufgetreten. Bitte starten Sie Anki neu und halten Sie während des Startvorgangs die Umschalttaste gedrückt, damit Anki die installierten Erweiterungen temporär deaktiviert. Wenn das Problem nur auftritt, wenn die Erweiterungen aktiviert sind, dann benutzen Sie bitte den Menueintrag Extras > Erweiterungen um die problembehaftete Erweiterung durch selektives Deaktivieren herauszufinden. Wenn Sie die entsprechende Erweiterung herausgefunden haben, dann bitten wir, dass Sie sich mit einem entsprechenden Problembericht an die Support-Seite für Erweiterungen wenden, damit der Fehler behoben werden kann. Debuginformationen: Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.14.1 PyQt 5.14.1 Platform: Mac 12.6.1 Flags: frz=True ao=True sv=3 Add-ons, last update check: 2022-12-01 10:22:33 Möglicherweise beteiligte Erweiterungen: ⁨Leech Toolkit⁩

Caught exception: Traceback (most recent call last): File "aqt.taskman", line 122, in _on_closures_pending File "aqt.taskman", line 71, in File "aqt.taskman", line 90, in wrapped_done File "aqt.operations", line 125, in wrapped_done File "aqt.reviewer", line 437, in after_answer File "aqt.reviewer", line 450, in _after_answering File "aqt.hooks_gen", line 3345, in call File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 229, in on_answer_v3 self.on_answer(context, card, ease) File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 368, in on_answer self.handle_card_updates(card, handle_card_answer) File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 287, in handle_card_updates changes = self.reviewer.mw.col.merge_undo_entries(last_step) File "anki.collection", line 1004, in merge_undo_entries File "anki._backend.generated", line 1756, in merge_undo_entries File "anki._backend", line 146, in _run_command anki.errors.InvalidInput: Ungültige Eingabe: ⁨target undo op not found⁩

:)

iamjustkoi commented 1 year ago

As I review my cards an error message pops up as soon as I rate an card (happens about every 10th or so card)

Ope, sorry you're running into this! I created a quick patch that might fix the issue here: https://github.com/iamjustkoi/LeechToolkit/releases/download/v1.1.1-a1/LeechToolkit.ankiaddon

Defs let me know how that goes! Will continue to try and look into it more on my end, though, too.

Ankilli commented 1 year ago

Thank you so much for the reply & quick fix! I tried it but unfortunately the issue still persists :) But as far as I can tell it happens far less (like every 40th-50th card) Apart from that the error message changed a tiny bit:

I highlighted the differences in bold text as far as I spotted them. I also noticed that the (most recent) error message ist always the same:

[…] Debuginformationen: Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.14.1 PyQt 5.14.1 Platform: Mac 12.6.1 Flags: frz=True ao=True sv=3 Add-ons, last update check: 2022-12-02 10:38:19 Möglicherweise beteiligte Erweiterungen: ⁨Leech Toolkit⁩

Caught exception: Traceback (most recent call last): File "aqt.taskman", line 122, in _on_closures_pending File "aqt.taskman", line 71, in File "aqt.taskman", line 90, in wrapped_done File "aqt.operations", line 125, in wrapped_done File "aqt.reviewer", line 437, in after_answer File "aqt.reviewer", line 450, in _after_answering File "aqt.hooks_gen", line 3345, in call File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 229, in on_answer_v3 self.on_answer(context, card, ease) File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 379, in on_answer self.handle_card_updates(card, handle_card_answer) File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/reviewer.py", line 295, in handle_card_updates changes = self.reviewer.mw.col.merge_undo_entries(last_step) File "anki.collection", line 1004, in merge_undo_entries File "anki._backend.generated", line 1756, in merge_undo_entries File "anki._backend", line 146, in _run_command anki.errors.InvalidInput: Ungültige Eingabe: ⁨target undo op not found⁩

Another thing I noticed: When I select a leech to Un-leech it, a small window ('conf') pops up (see attachment) Bildschirmfoto 2022-12-02 um 13 32 29

So far amazing addon with impressive depths! :o

iamjustkoi commented 1 year ago

Thank you so much for the reply & quick fix!

No prob!

as far as I can tell it happens far less (like every 40th-50th card)

Shoot, that makes it a bit weirder to figure out. I made another build that might be able to fix the issue, or at least cause an extra undo step instead of outputting an error (linked below).

When I select a leech to Un-leech it, a small window ('conf') pops up (see attachment)

Oh boy, uh, I might move this to another thread, but will have to see how it goes.

For the time being, I made a quick debug patch on top of the previous fix: https://drive.google.com/file/d/103Bio5kbizH7znIh1BiqF10uTHtHUgeK/view?usp=sharing

It should output a new file in the add-on's directory (Tools -> Add-ons -> Leech Toolkit (select) -> View Files) called "browser-debug.txt" after you try to leech/un-leech a card in the browser window.

If you can send me the file/contents I might be able to pinpoint the issue better, probably.

So far amazing addon with impressive depths! :o

Thanks so much, happy you're enjoying it! :D

Ankilli commented 1 year ago

Thank you! I installed the quick debug patch but now the addon won't load and I get the following error message (attached).

Translation: One of the installed extensions could will not be loaded. If the problem continues exists, please click on the menu item Extras - extensions that disable extensions or uninstall

When loading 'Leech Toolkit': Traceback (most recent call last): File "aqt.addons",line 244, in loadAddons file"/users/angle/library/application Support/Anki2/addons21/368380974/ Init _.py",line 5,in from.src import options, reviewer, bottombar, deckoptions,sync, browser file"/users/angle/library/application Support/Anki2/addons21/368380974/src/ options.py",line 69,in from.. res.ui.actions_formimport Ui ActionsForm file"/users/angle/library/application Support/Anki2/addons21/368380974/res/ui/ actions_form.py",line 9,in from PyQt6 import QtCore, QtGui, QtWidgets ModuleNotFoundError: No module named 'PyQ+6'

':D

Bildschirmfoto 2022-12-02 um 18 59 07

iamjustkoi commented 1 year ago

Oh, whoops! The auto imports get me every time.

Should be fixed now (new upload): https://drive.google.com/file/d/103Bio5kbizH7znIh1BiqF10uTHtHUgeK/view?usp=sharing

Ankilli commented 1 year ago

thank you, now it worked :)

Just to be clear: I started Anki, tried to un-leech a leech -> 'conf'-window popped up -> I looked for the browser-debug.txt and it says the following:

checkpoint-0 File "C:\Users\jtrit\Python\Anki\anki-main-env\runanki.py", line 83, in aqt.run() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt__init.py", line 458, in run _run() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt__init.py", line 640, in _run app.exec() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt\browser\table\table.py", line 473, in _on_context_menu menu.exec(QCursor.pos()) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 94, in lambda args: apply_action_updates(manager, browser, Config.UN_LEECH_ACTIONS) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 203, in apply_action_updates stack += traceback.format_stack() checkpoint-post File "C:\Users\jtrit\Python\Anki\anki-main-env\runanki.py", line 83, in aqt.run() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt__init__.py", line 458, in run _run() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt__init__.py", line 640, in _run app.exec() File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt\browser\table\table.py", line 473, in _on_context_menu menu.exec(QCursor.pos()) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 94, in lambda args: apply_action_updates(manager, browser, Config.UN_LEECH_ACTIONS) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 206, in apply_action_updates stack += traceback.format_stack() checkpoint-1 File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 908, in _bootstrap self._bootstrap_inner() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner self.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run self._target(*self._args, self._kwargs) File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 77, in _worker work_item.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(*self.args, *self.kwargs) File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt\operations__init__.py", line 105, in wrapped_op return self._op(mw.col) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 204, in start_collection_op(browser, lambda col: action_operation(col), tip_message, len(browser.selected_cards())) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 160, in action_operation stack += traceback.format_stack() checkpoint-2 File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 908, in _bootstrap self._bootstrap_inner() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner self.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run self._target(self._args, self._kwargs) File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 77, in _worker work_item.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt\operations\init__.py", line 105, in wrapped_op return self._op(mw.col) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 204, in start_collection_op(browser, lambda col: action_operation(col), tip_message, len(browser.selected_cards())) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 175, in action_operation stack += traceback.format_stack() checkpoint-3 File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 908, in _bootstrap self._bootstrap_inner() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner self.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run self._target(*self._args, *self._kwargs) File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 77, in _worker work_item.run() File "C:\Users\jtrit\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run result = self.fn(self.args, **self.kwargs) File "C:\Users\jtrit\Python\Anki\anki-qt5-env\lib\site-packages\aqt\operations\init__.py", line 105, in wrapped_op return self._op(mw.col) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 204, in start_collection_op(browser, lambda col: action_operation(col), tip_message, len(browser.selected_cards())) File "C:\Users\jtrit\AppData\Roaming\Anki2\addons21\368380974\src\browser.py", line 187, in action_operation stack += traceback.format_stack()

hope it helps :)

iamjustkoi commented 1 year ago

thank you, now it worked :)

Just to be clear: I started Anki, tried to un-leech a leech -> 'conf'-window popped up -> I looked for the browser-debug.txt and it says the following: ... hope it helps :)

Oh, shoot, that's a bit dumb of me. Looks like it didn't work, actually! I just packed my test build in with everything, so that ended up being the file I accidentally uploaded. Sorry about that! Just letting some small mistakes through over and over again, right now.

This version should actually work, now, and include the correct file paths this time for writing (thanks for being patient with me!):

https://drive.google.com/file/d/103Bio5kbizH7znIh1BiqF10uTHtHUgeK/view?usp=sharing

(just gonna hide the previous comment, for the time being)

Ankilli commented 1 year ago

Hmmm I tried multiple times but a .txt. file is not being created :/

I wonder why nobody else mentioned anything like that yet ':D

iamjustkoi commented 1 year ago

Hmmm I tried multiple times but a .txt. file is not being created :/

Oh, actually, it not working is a pretty good clue, too! Made another edit, this time it should output a text file, otherwise I can't think of much else I can do on my end, unfortunately.

I wonder why nobody else mentioned anything like that yet ':D

Yeah, may end of being OS-specific or something more unique to your install. Hopefully nothing too bad, though.

(https://drive.google.com/file/d/103Bio5kbizH7znIh1BiqF10uTHtHUgeK/view?usp=sharing)

If that doesn't end up making anything though, you might also want to try going to wherever you have Anki's launcher and launching it with the console version (same folder), instead (probs a .bat, or .sh file, or something else with console in its name). It might give a bit more of a clue for what's happening when you run the Un-Leech/Leech action in the browser.

Oh, also, just double checking if the first issue was solved or not, just in case? Will probs move this to a new thread for better tracking.

Ankilli commented 1 year ago

this time it should output a text file

unfortunately not :/

launching it with the console version

I will try that one, never heard of this even existing so far^^

Edit: Okay, so I could only use the Terminal.app on macOS for logging everything that happens in Anki.

When I try to Leech or Un-leech a card the following appears: Traceback (most recent call last): File "concurrent.futures.thread", line 52, in run File "aqt.operations", line 105, in wrapped_op File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/browser.py", line 200, in start_collection_op(browser, lambda col: action_operation(col), tip_message, len(browser.selected_cards())) File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/browser.py", line 154, in action_operation toolkit_configs = manager.get_all_configs() File "/Users/Winkel/Library/Application Support/Anki2/addons21/368380974/src/config.py", line 48, in get_all_configs config_id = self._mw.col.decks.get(deck_name_id.id)['conf'] KeyError: 'conf'

Oh, also, just double checking if the first issue was solved or not, just in case? Will probs move this to a new thread for better tracking.

I will know tomorrow as I do my reviews and see if the error pops up again :) But tbh if I get an error message every 40th to 50th card it's not the end of the world ';D

iamjustkoi commented 1 year ago

KeyError: 'conf'

Nicely done, thought it was something like this! Thanks for sticking with it! I'll see what I can do about building a fix for it as soon as I can.

I will know tomorrow as I do my reviews and see if the error pops up again :) But tbh if I get an error message every 40th to 50th card it's not the end of the world ';D

Haha, sounds good, will still try to fix up as much as I can on my end! 👍

iamjustkoi commented 1 year ago

KeyError: 'conf'

Also gonna move this one over to a new thread (#6).

Ankilli commented 1 year ago

I will know tomorrow as I do my reviews and see if the error pops up again :)

I reviewed around 700 cards and not a single error msg popped up! Guess it's fixed then, good job! 👍

My version is 1.1.1-a4

iamjustkoi commented 1 year ago

I reviewed around 700 cards and not a single error msg popped up! Guess it's fixed then, good job! 👍

Actually I'm pretty sure this is causing issue #7 now, to be honest! Gonna keep the thread open until I can push the fix to the main branch/schedule for release, for the time being.

Appreciate it, either way! 😄

iamjustkoi commented 1 year ago

Scheduled for the next release!

Should be fully resolved in this most recent hot-fix: https://github.com/iamjustkoi/LeechToolkit/releases/download/v1.1.1-a5/LeechToolkit.ankiaddon

Thanks again for reporting in!