When is next learning card due today due [Official thread]

If you have a problem with the add-on when is next learning card due today due post in this thread. This way I get notified. If you make a new thread I will likely miss it. If you post your comment, question or bug report on ankiweb as a review I won’t get notified. You really should post in this thread.

1 Like

I just switched to the 2.1 scheduler beta. Prior to the switch, everything seemed to work smoothly, but now I get the following error message with this addon enabled (disclaimer: I’m still a relative novice, I have no idea what this all means)

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you’ve discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.22 (0ecc189a) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=?
Add-ons, last update check: 2020-06-17 06:47:37

Caught exception:
Traceback (most recent call last):
File “aqt\progress.py”, line 76, in handler
File “aqt\main.py”, line 158, in setupProfileAfterWebviewsLoaded
File “aqt\main.py”, line 195, in setupProfile
File “aqt\main.py”, line 345, in loadProfile
File “<C:\Program Files\Anki\decorator.pyc:decorator-gen-106>”, line 2, in loadCollection
File “lib\site-packages\anki\hooks.py”, line 666, in decorator_wrapper
File “lib\site-packages\anki\hooks.py”, line 657, in repl
File “<C:\Program Files\Anki\decorator.pyc:decorator-gen-104>”, line 2, in loadCollection
File “lib\site-packages\anki\hooks.py”, line 666, in decorator_wrapper
File “lib\site-packages\anki\hooks.py”, line 657, in repl
File “<C:\Program Files\Anki\decorator.pyc:decorator-gen-102>”, line 2, in loadCollection
File “lib\site-packages\anki\hooks.py”, line 666, in decorator_wrapper
File “lib\site-packages\anki\hooks.py”, line 658, in repl
File “C:\Users\eller\AppData\Roaming\Anki2\addons21\874215009\advancedbrowser\basic_fields.py”, line 75, in myLoadCollection
mw.col.db._db.create_function(“nameForDeck”, 1, self.nameForDeck)
AttributeError: ‘NoneType’ object has no attribute ‘db’

1 Like

This should be an error in the add-on “Advanced Browser”: Check the third line from the bottom.

Check your add-ons for updates. If this doesn’t help you could disable “Advanced Browser”. After updating or disabling you must restart Anki.

Personally I would use the latest Anki version 2.1.26 which allows you to use the latest version of “Advanced Browser”.

1 Like

Interesting. If I disable “Advanced Browser” and enable “When is next learning card due today due” I still get the error message. When I enable “Advanced Browser” and disable this add-on, the issue goes away.

I see what you mean about the error message implicating Advanced Browser, though, so I’m not sure what’s wrong. The reason I posted it here was because the error message seems dependent on whether or not I have this add-on enabled, sorry if I am missing something!

I checked for updates and none are available. I will consider using the latest Anki version, I’d just avoided it because I’m not sure all the add-ons I use support it

Have you restarted after this before you checked out my add-on.

I have one database query in my add-on, see here and this query is setup just as described in the add-on creation guide, see here. I’m pretty sure that the function I modify is only called once the database has been loaded so that “db” is should never be None.

You could change my add-on so and replace in __init__.py of my add-on:

all_learning = aqt.mw.col.db.all(sqlstring)

with

try:
    all_learning = aqt.mw.col.db.all(sqlstring)
except:
    return

Does this help?

 

Advanced Browser is a great. But as far as I see it has to perform all kinds of “black magic” to workaround limitations from Anki. So it’s more likely that the AB causes the problem in my view. But AB is much more useful than my add-on. Just disable my add-on or delete it and if you are still interested in it after upgrading to a more recent anki version enable or reinstall it.

2 Likes

Not a coding person (apologies), but I changed it and got this error message:

It’s not a huge deal for me if I can’t get it to work. Anyways, thank you for your help and for the add-on!

1 Like

I guess I could have made it more clear what I want you to do. Your problem is that you don’t have enough spaces before the try line. If this code solves the problem for you I could upload it for everyone to ankiweb. But before I do this it would be nice to have confirmation that it actually solves a problem. So you would really help.

I mean to change this

def whenIsNextLrnDue(sqlstring, append_relative):
    all_learning = aqt.mw.col.db.all(sqlstring)
    if not all_learning:
        return

to this

def whenIsNextLrnDue(sqlstring, append_relative):
    try:
        all_learning = aqt.mw.col.db.all(sqlstring)
    except:
        return
    if not all_learning:
        return

It’s important that the lines are properly indented. Maybe copy and paste this code from here?

In my code I indent with spaces so you must also use spaces. Some people like to indent with “tab” which is also fine in general. But in python3 you may not mix tabs and spaces for indenting.

2 Likes

Seems to work! No longer getting an error message.

1 Like

Hi I recently downloaded your add-on for version 2.1.26.
At first it worked fine, but suddenly showed an error message like the following

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you’ve discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.26 (70784154) Python 3.8.0 Qt 5.13.1 PyQt 5.14.1
Platform: Mac 10.15.7
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-01-30 14:37:29
Add-ons possibly involved: ⁨when is next learning card due today due⁩

Traceback (most recent call last):
File “aqt/main.py”, line 497, in loadCollection
File “aqt/main.py”, line 632, in moveToState
File “aqt/main.py”, line 639, in _deckBrowserState
File “aqt/deckbrowser.py”, line 54, in show
File “aqt/deckbrowser.py”, line 110, in _renderPage
File “aqt/deckbrowser.py”, line 116, in __renderPage
File “</Applications/Anki.app/Contents/MacOS/decorator.pyc:decorator-gen-92>”, line 2, in _renderStats
File “anki/hooks.py”, line 638, in decorator_wrapper
File “anki/hooks.py”, line 635, in repl
File “/Users/mallard/Library/Application Support/Anki2/addons21/563204849/init.py”, line 104, in deckbrowserMessage
add_this = whenIsNextLrnDue(sql_string_all, False)
File “/Users/mallard/Library/Application Support/Anki2/addons21/563204849/init.py”, line 37, in whenIsNextLrnDue
dayOffset = aqt.mw.col.conf[‘rollover’] # by default 4
File “anki/config.py”, line 45, in getitem
File “anki/config.py”, line 33, in get_immutable
File “anki/rsbackend.py”, line 585, in get_config_json
KeyError

After I disable the add-on everything else seems to work perfectly fine.
I previously was experimenting with different versions of Anki (2.1.26 and 2.1.36).
The time I had the add-on work fine was when I had both versions installed. I had some unexpected crashes and I believe they occurred due to some problems from alternating between multiple versions. I don’t know how that info would help in any way, but seemed best to tell you everything.

@mallard : Thanks for reporting this. At the moment I’m quite busy and the upcoming anki 2.1.41 will break some of my other add-ons which I need to fix first so it’ll take some time until I can look at this.

Hi, can I change the position of the addon on the deck screen so that it appears just below “More deck stats and Time Left” Addon. The next learning card phrase appears to me below review heatmap and above motivanki.

@Amr_Dawoud : As far as I see there’s no easy way to do this because my add-on - as well as the other ones - tell Anki to load our custom code. Anki decides the order in which the content is shown (which should be order of the add-ons loaded which is determined by the add-on number). maybe rename the folder of my add-on so that it’s between the other add-ons?

Apart from this there should be some ways around it, e.g. making sure that my add-on only access the gui_hooks after the other ones are added (and maybe then trying to modify them) but that’s pretty complicated.

I must say I’m not too interested in looking into this because my understanding is that in a few months Anki will modernize these parts in coming releases so that add-ons related to this might need an update anyway.

1 Like

Thanks, just putting the Folder Name between Parentheses moved it up. Now it’s below New Card Counter which looks nice.

after this update,I can not see this addons on the main window,my anki version is 2.1.49
maybe there is some bugs,please fix it🙏🏻

you can ask in the forum or the anki subreddit to hire a coder. maybe look on a freelancer platform liker fiverr.

I haven’t hired someone over this platform. As far as I see there’s someone who has contributed to anki itself named abdnh (Abdo) · GitHub who also is on this freelancer platform: https://www.fiverr.com/abd_nh But that’s all I know about it - I have never hired someone from this platform. If you decide to hire someone let me know how it went with this person so that I can make better suggestions the next time someone asks me.

1 Like