jolly-crimson
jolly-crimson17mo ago

Getting an Error trying to Reset Database with Migaku Kanji God Add-on

I am trying to reset my database for the Migaku Kanji God Add-on. I click on Kanji > Settings > General > Reset Database. Then Anki gives me an error popup. Here is the debug info.
Anki 23.12.1 (1a1d4d54) (ao)
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1
Platform: Windows-10-10.0.22621

Traceback (most recent call last):
File "C:\Users\chris\AppData\Roaming\Anki2\addons21\1872210448\settings_window.py", line 459, in on_reset_db
QMessageBox.StandardButton.Yes | QMessageBox.No,
AttributeError: type object 'QMessageBox' has no attribute 'No'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Migaku Kanji GOD ['1872210448', 2023-12-22T00:43, 'None', mod]

===IDs of active AnkiWeb add-ons===
1872210448

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Anki 23.12.1 (1a1d4d54) (ao)
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1
Platform: Windows-10-10.0.22621

Traceback (most recent call last):
File "C:\Users\chris\AppData\Roaming\Anki2\addons21\1872210448\settings_window.py", line 459, in on_reset_db
QMessageBox.StandardButton.Yes | QMessageBox.No,
AttributeError: type object 'QMessageBox' has no attribute 'No'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Migaku Kanji GOD ['1872210448', 2023-12-22T00:43, 'None', mod]

===IDs of active AnkiWeb add-ons===
1872210448

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
I'm not sure how relevant it is, but I am on Windows 10 when the debug info says windows 11. It also doesn't say in the debug message but in the about section for the Add On, it says it's version 1.2.0
No description
20 Replies
unwilling-turquoise
unwilling-turquoise17mo ago
I think someone just forgot to useQMesageBox.StandardButton.No @Migaku Kanji Addon Support
jolly-crimson
jolly-crimsonOP17mo ago
i think so too, i tried adding it myself but i don't know how to recompile the addon
unwilling-turquoise
unwilling-turquoise17mo ago
jolly-crimson
jolly-crimsonOP17mo ago
i don't think that's it, unless I'm missing something, that just says how to organize your zip file for distributing your own addons, not how to recompile one that you've downloaded from ankiweb
unwilling-turquoise
unwilling-turquoise17mo ago
oh, no. Anki addons mostly are python scripts You should edit the source code
GitHub
GitHub - migaku-official/Migaku-Kanji-Addon: Learn kanji within the...
Learn kanji within the context of the vocab in your Anki collection. Comes with a powerful lookup browser. - GitHub - migaku-official/Migaku-Kanji-Addon: Learn kanji within the context of the vocab...
jolly-crimson
jolly-crimsonOP17mo ago
lol, you mean like make a PR to fix the change? i tried doing it locally and it didn't do anything
unwilling-turquoise
unwilling-turquoise17mo ago
You can make a PR or create .ankiaddon for yourself
No description
jolly-crimson
jolly-crimsonOP17mo ago
hmm, maybe i'll try that later, seems like a lot of work considering i've never done it before even if it's relatively simple
unwilling-turquoise
unwilling-turquoise17mo ago
They have a CI for building. Maybe try to change the file and follow steps in this script?
GitHub
Migaku-Kanji-Addon/.github/workflows/build.yml at main · migaku-off...
Learn kanji within the context of the vocab in your Anki collection. Comes with a powerful lookup browser. - migaku-official/Migaku-Kanji-Addon
jolly-crimson
jolly-crimsonOP17mo ago
that script looks like it just uploads for public release, unless i'm missing something in the workflow, it doesn't look like it builds it, rn i'm under the impression that it's built when you add it on anki i think the only way would be to fork it, make the change, then add it as a separate add on, tho again, i'll try later, not now
unwilling-turquoise
unwilling-turquoise17mo ago
mkdir dist
echo "VERSION_STRING = %VERSION%" > addon/version.py # change %VERSION% to some random version 1.21 for example
bash tools/kanjivg_download.sh
python3 tools/kanjivg_cleanup.py
cd addon
zip -r ../dist/MigakuKanjiGOD.ankiaddon . -x user_files/\* meta.json
cd ..
mkdir dist
echo "VERSION_STRING = %VERSION%" > addon/version.py # change %VERSION% to some random version 1.21 for example
bash tools/kanjivg_download.sh
python3 tools/kanjivg_cleanup.py
cd addon
zip -r ../dist/MigakuKanjiGOD.ankiaddon . -x user_files/\* meta.json
cd ..
It is all build steps. You don't need to upload anything You can install .ankiaddon directly into anki
No description
unwilling-turquoise
unwilling-turquoise17mo ago
@Sir can you try this one?
unwilling-turquoise
unwilling-turquoise17mo ago
Versioning here definitely isn't right (1.2.0 -> 1.21 😅 ), but I hope it should work
jolly-crimson
jolly-crimsonOP17mo ago
yes, that fixed the bug, I really appreciate you taking the time to help is the only change you made to the code adding the ".standardButton"? also do you think you'll make a PR with those fixes? if not I might
unwilling-turquoise
unwilling-turquoise17mo ago
Exactly, I changed it only in 2 places ( choices and default choice ) This problem may also occur in reseting custom stories/keywords Can you check it please?
No description
jolly-crimson
jolly-crimsonOP17mo ago
I'll check after work, from a quick glance, I did notice it in a few other places in the same file
unwilling-turquoise
unwilling-turquoise17mo ago
It's below on_reset_db function I have changed only reset_db, so that's why i'm asking about other ones (I have cheked anki addon by code and I haven't this problem, so I can't reproduce unfortunetly )
No description
No description
jolly-crimson
jolly-crimsonOP17mo ago
oh sorry, i misunderstood, I also only checked the code lol, I just checked Anki and there is a similar problem with Reset Custom Keywords and Reset Custom Stories
unwilling-turquoise
unwilling-turquoise17mo ago
Then I will change every QmessageBox.No to use StandardButton and hope that my pull request will be accepted
fair-rose
fair-rose17mo ago
@Henrik (JST)

Did you find this page helpful?