trgkanki / remaining_time

GNU Affero General Public License v3.0
18 stars 3 forks source link

Erro in Anki 23.10beta6 #78

Open cjdduarte opened 1 year ago

cjdduarte commented 1 year ago

Anki 23.10 (72e57456) Python 3.9.15 Qt 6.5.2 PyQt 6.5.2 Platform: Windows-10-10.0.22621 Flags: frz=True ao=True sv=3 Add-ons, last update check: 2023-10-14 09:01:10 Extensões possivelmente envolvidas: ⁨Remaining time for Anki 21⁩

Caught exception: Traceback (most recent call last): File "aqt.webview", line 46, in cmd File "aqt.webview", line 153, in _onCmd File "aqt.webview", line 660, in _onBridgeCmd File "_aqt.hooks", line 5407, in call File "C:\Anki\Anki.2.1.data\addons21\1508357010\utils\JSCallable.py", line 29, in _onBridgeMessage ret = func(*argList) File "C:\Anki\Anki.2.1.data\addons21\1508357010\jsapi\remainingCardCount.py", line 10, in getCurrentRemainingCardCount if reviewer.hadCardQueue: AttributeError: 'Reviewer' object has no attribute 'hadCardQueue'

AuroraWright commented 11 months ago

You can replace remainingCardCount.py with this to fix (just used the aqt.reviewer.Reviewer._remaining() code from latest Anki, as per the dev's comment)

from ..utils.JSCallable import JSCallable
from typing import cast, Union
from aqt import mw

@JSCallable
def getCurrentRemainingCardCount():
    reviewer = mw.reviewer

    # Code from aqt.reviewer.Reviewer._remaining()
    counts: list[Union[int, str]]
    idx, counts_ = reviewer._v3.counts()
    counts = cast(list[Union[int, str]], counts_)

    nu, lrn, rev = counts
    return nu, lrn, rev
phu54321 commented 11 months ago

Need a time to init VM with newest Anki installation to test with.

I won't upgrade my main Anki to 23.10 (as I'm using other addons)

AuroraWright commented 11 months ago

I noticed using that reviewer code as-is still causes a crash when you finish reviews, this seems to fix that as well:

from ..utils.JSCallable import JSCallable
from typing import cast, Union
from aqt import mw

@JSCallable
def getCurrentRemainingCardCount():
    reviewer = mw.reviewer

    if reviewer.card == None:
        counts = [0, 0, 0]
    else:
        # Code from aqt.reviewer.Reviewer._remaining()
        counts: list[Union[int, str]]
        idx, counts_ = reviewer._v3.counts()
        counts = cast(list[Union[int, str]], counts_)

    nu, lrn, rev = counts
    return nu, lrn, rev
cjdduarte commented 11 months ago

I noticed using that reviewer code as-is still causes a crash when you finish reviews, this seems to fix that as well:

from ..utils.JSCallable import JSCallable
from typing import cast, Union
from aqt import mw

@JSCallable
def getCurrentRemainingCardCount():
    reviewer = mw.reviewer

    if reviewer.card == None:
        counts = [0, 0, 0]
    else:
        # Code from aqt.reviewer.Reviewer._remaining()
        counts: list[Union[int, str]]
        idx, counts_ = reviewer._v3.counts()
        counts = cast(list[Union[int, str]], counts_)

    nu, lrn, rev = counts
    return nu, lrn, rev

image

phu54321 commented 10 months ago

Could you try:

build.zip

Addon will have an error on the first Anki run. IDK how to fix it though... Addon will work on subsequent runs.

FH10003 commented 10 months ago

It still doesnt work? I tried adding the build.zip anki add on but it wont even let me add is as an add on. Dont know what to do now, keep getting same error.

Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3 Platform: macOS-13.5-arm64-arm-64bit

When loading remaining_time: Traceback (most recent call last): File "aqt.addons", line 245, in loadAddons File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/init.py", line 25, in from .utils import uuid # duplicate UUID checked here File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/utils/uuid.py", line 52, in dupUUIDCheck() File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/utils/uuid.py", line 45, in dupUUIDCheck raise RuntimeError( RuntimeError: Duplicate addon UUID 33b5ab52-7c44-4da7-92d4-4bf890a40f28 (previously registered on /Users/fatimahasan/Library/Application Support/Anki2/addons21/1508357010/utils/uuid.py

phu54321 commented 10 months ago

When loading remaining_time: Traceback (most recent call last): File "aqt.addons", line 245, in loadAddons File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/init.py", line 25, in from .utils import uuid # duplicate UUID checked here File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/utils/uuid.py", line 52, in dupUUIDCheck() File "/Users/fatimahasan/Library/Application Support/Anki2/addons21/remaining_time/utils/uuid.py", line 45, in dupUUIDCheck raise RuntimeError( RuntimeError: Duplicate addon UUID 33b5ab52-7c44-4da7-92d4-4bf890a40f28 (previously registered on /Users/fatimahasan/Library/Application Support/Anki2/addons21/1508357010/utils/uuid.py

Remove the previous version and then install the build.ankiaddon version.

phu54321 commented 9 months ago

https://github.com/trgkanki/remaining_time/releases/tag/v24.1.22i135

Test release. I cannot upload this to AnkiWeb (IDK why... maybe I should contact AnkiWeb admins), so I am distributing it here as an alternative.

Remove previous installation before installing this one

Vulkatnos commented 9 months ago

https://github.com/trgkanki/remaining_time/releases/tag/v24.1.22i135

Test release. I cannot upload this to AnkiWeb (IDK why... maybe I should contact AnkiWeb admins), so I am distributing it here as an alternative.

Remove previous installation before installing this one

Im getting an Error when trying to install "dist_remaining_time.ankiaddon": Invalid extension manifest

phu54321 commented 9 months ago

Sorry for inconvenience:

dist_remaining_time.zip

Vulkatnos commented 9 months ago

It now works, thank you very much!

(there still is an initial error, but this only occures on the first execution of Anki after installation after this the error no longer occures)

gigapudding43201 commented 9 months ago

Still getting an error

Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.6.1 PyQt 6.6.1 Platform: Windows-10-10.0.22631

Traceback (most recent call last): File "aqt.webview", line 50, in cmd File "aqt.webview", line 157, in _onCmd File "aqt.webview", line 680, in _onBridgeCmd File "_aqt.hooks", line 5415, in call File "C:\Users\joena\AppData\Roaming\Anki2\addons21\remaining_time\utils\JSCallable.py", line 29, in _onBridgeMessage ret = func(*argList) File "C:\Users\joena\AppData\Roaming\Anki2\addons21\remainingtime\jsapi\remainingCardCount.py", line 21, in getCurrentRemainingCardCount , counts = reviewer._v3.counts() AttributeError: 'NoneType' object has no attribute 'counts'

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Add Hyperlink ['318752047', 2023-06-18T06:39, 'None', ''] Advanced Browser ['874215009', 2023-10-21T09:34, 'None', ''] AnKing Note Types Easy Customization ['952691989', 2024-01-19T15:17, 'None', mod] Batch Editing ['291119185', 2023-10-25T19:38, 'None', ''] BetterSearch ['1052724801', 2023-06-15T15:44, 'None', ''] Browser Resizer ['1435775540', 2023-11-11T11:16, 'None', ''] Browser TableEditor side-by-side horizontal split ['831846358', 2022-01-25T16:11, 'None', ''] Create Filtered Deck from the Browser ['861263371', 2017-08-29T13:57, 'None', ''] Customize Keyboard Shortcuts ['24411424', 2023-11-01T04:17, 'None', ''] Image Editor ['307397307', 2022-09-07T23:09, 'None', ''] Rebuild All Empty All for Anki 21 ['1810938259', 2018-07-19T23:40, 'None', ''] Review Heatmap ['1771074083', 2022-06-29T20:43, 'None', ''] Special Fields ['1102281552', 2023-11-01T11:37, 'None', mod] remaining_time ['remaining_time', 0, '24.1.23i147', '']

===IDs of active AnkiWeb add-ons=== 1052724801 1102281552 1435775540 1771074083 1810938259 24411424 291119185 307397307 318752047 831846358 861263371 874215009 952691989

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed])

feelingformal5145 commented 9 months ago

i am still getting start up failed with this

Sorry for inconvenience:

dist_remaining_time.zip

phu54321 commented 9 months ago

i am still getting start up failed with this

Sorry for inconvenience: dist_remaining_time.zip

What error?

feelingformal5145 commented 9 months ago

i am still getting start up failed with this

Sorry for inconvenience: dist_remaining_time.zip

What error?

Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3 Platform: macOS-14.2.1-arm64-arm-64bit

Traceback (most recent call last): File "aqt.progress", line 118, in handler File "aqt.main", line 218, in on_window_init File "aqt.main", line 317, in setupProfile File "aqt.main", line 496, in loadProfile File "_aqt.hooks", line 4107, in call File "anki.hooks", line 34, in runHook File "/Users/jerilynsimons/Library/Application Support/Anki2/addons21/remaining_time/utils/configrw.py", line 96, in _syncJSConfig from .uuid import addonUUID File "", line 1007, in _find_and_load File "", line 982, in _find_and_load_unlocked File "", line 925, in _find_spec File "", line 1423, in find_spec File "", line 1389, in _get_spec File "", line 1252, in iter File "", line 1239, in _recalculate File "", line 1235, in _get_parent_path KeyError: 'remaining_time'

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Custom Background Image and Gear Icon ['1210908941', 2023-04-18T20:19, 'None', mod] Delay Overdue Cards ['43919973', 2020-08-16T17:10, 'None', ''] Find cards from UWorld test ['444814983', 2023-10-23T04:03, 'None', ''] Image Occlusion Enhanced ['1374772155', 2022-04-09T02:15, 'None', ''] Review Heatmap ['1771074083', 2022-06-29T20:43, 'None', ''] remaining_time ['remaining_time', 0, '24.1.23i147', '']

===IDs of active AnkiWeb add-ons=== 1210908941 1374772155 1771074083 43919973 444814983

===Add-ons (inactive)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) Anki Habitica for 21 ['1758045507', 2023-12-16T06:33, 'None', ''] ImageResizer ['1214357311', 2023-12-02T19:58, 'None', ''] More Decks Stats and Time Left ['1556734708', 2023-09-24T09:08, 'None', ''] Progress Bar cards done cards left secondscard time spentleft and ETA ['1097423555', 2023-10-02T03:05, 'None', '']

phu54321 commented 9 months ago

Don't know how to fix this, sorry

TiddiCorp commented 9 months ago

Hi! I downloaded the zip file you provided above but it's still experiencing errors. Here is the code below:

Anki 23.12.1 (1a1d4d54) (ao) Python 3.9.15 Qt 6.5.3 PyQt 6.5.3 Platform: macOS-13.6.3-x86_64-i386-64bit

When loading remaining_time: Traceback (most recent call last): File "aqt.addons", line 245, in loadAddons File "/Users/tristan/Library/Application Support/Anki2/addons21/remaining_time/init.py", line 24, in from .utils import openChangelog File "/Users/tristan/Library/Application Support/Anki2/addons21/remaining_time/utils/openChangelog.py", line 44, in showChangelogOnUpdate() File "/Users/tristan/Library/Application Support/Anki2/addons21/remaining_time/utils/openChangelog.py", line 40, in showChangelogOnUpdate dlg = MiniBrowser(None, "CHANGELOG.html") File "/Users/tristan/Library/Application Support/Anki2/addons21/remaining_time/utils/MiniBrowser.py", line 41, in init self.setWindowFlags(Qt.Window) AttributeError: type object 'Qt' has no attribute 'Window'

Boehnchen-456 commented 9 months ago

i encountered the same problem and downloaded the zip file. I thouht it wasn't working but now I noticed that everything works fine if I start anki while offline, open the deck and then connect to wifi. i only get the error when starting anki while connected to wifi. Once it works, i can also open a new deck and it will still work alright! Hope this helps!

pzh200707 commented 9 months ago

I noticed using that reviewer code as-is still causes a crash when you finish reviews, this seems to fix that as well:

from ..utils.JSCallable import JSCallable
from typing import cast, Union
from aqt import mw

@JSCallable
def getCurrentRemainingCardCount():
    reviewer = mw.reviewer

    if reviewer.card == None:
        counts = [0, 0, 0]
    else:
        # Code from aqt.reviewer.Reviewer._remaining()
        counts: list[Union[int, str]]
        idx, counts_ = reviewer._v3.counts()
        counts = cast(list[Union[int, str]], counts_)

    nu, lrn, rev = counts
    return nu, lrn, rev

AuroraWright's solution is perfect for me by manually editing the file. Installing add-on from the zip file or github release causes error.

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 "aqt.webview", line 50, in cmd File "aqt.webview", line 157, in _onCmd File "aqt.webview", line 680, in _onBridgeCmd File "_aqt.hooks", line 5415, in call File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\remaining_time\utils\JSCallable.py", line 29, in _onBridgeMessage ret = func(*argList) File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\remainingtime\jsapi\remainingCardCount.py", line 21, in getCurrentRemainingCardCount , counts = reviewer._v3.counts() AttributeError: 'NoneType' object has no attribute 'counts'

===Add-ons (active)=== (add-on provided name [Add-on folder, installed at, version, is config changed]) remaining_time ['remaining_time', 0, '24.1.23i147', '']