Shift click deck options not working

This error appears when clicking with shift on the options button of any deck.
Anyone got any hints as to what may be wrong?

Debug info:
Anki 2.1.50 (db804d95) Python 3.10.1 Qt 6.2.2 PyQt 6.2.2
Platform: Linux
Flags: frz=False ao=True sv=3
Add-ons, last update check: 2022-01-17 10:00:33

Caught exception:
Traceback (most recent call last):
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 119, in onConfChange
    self.loadConf()
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/anki/hooks.py", line 89, in decorator_wrapper
    return repl(*args, **kwargs)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/anki/hooks.py", line 80, in repl
    old(*args, **kwargs)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 209, in loadConf
    f.lrnFactor.setValue(c["initialFactor"] / 10.0)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'

Caught exception:
Traceback (most recent call last):
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckbrowser.py", line 269, in <lambda>
    qconnect(a.triggered, lambda b, did=did: self._options(DeckId(int(did))))
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckbrowser.py", line 295, in _options
    display_options_for_deck_id(did)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckoptions.py", line 103, in display_options_for_deck_id
    display_options_for_deck(aqt.mw.col.decks.get(deck_id))
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckoptions.py", line 110, in display_options_for_deck
    aqt.deckconf.DeckConf(aqt.mw, deck_legacy)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 42, in __init__
    self.setupConfs()
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 78, in setupConfs
    self.loadConfs()
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 95, in loadConfs
    self.onConfChange(startOn)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 119, in onConfChange
    self.loadConf()
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/anki/hooks.py", line 89, in decorator_wrapper
    return repl(*args, **kwargs)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/anki/hooks.py", line 80, in repl
    old(*args, **kwargs)
  File "/home/yaoberh/pyenv/lib/python3.10/site-packages/aqt/deckconf.py", line 209, in loadConf
    f.lrnFactor.setValue(c["initialFactor"] / 10.0)
TypeError: setValue(self, int): argument 1 has unexpected type 'float'

May be caused by an add-on. Works for me.
Edit: Just noticed that I get a deprecation warning though:

DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  f.lapMult.setValue(c["mult"] * 100)

As I’m running Python 3.9.7, this may have stopped working with Python 10.

3 Likes

Yep, it’s a change in Python 3.10.

I’m on Anki 2.1.16, so this might not apply to the latest version. Still, a word of warning:

I ran into the same issue by selecting Options from the menu that pops up from the cogwheel next to a deck (albeit without holding shift). After the TypeError, the option group that would have been opened is always busted, e.g., daily review limit of zero, etc. So you might want to check if everything’s still okay on a Python <3.10 install.

Is it likely that this will get fixed or will the old deck option be removed?
I have some add-ons that still use the old deck options unfortunately.

This did and still works now. The old deck options will not be removed for some time.

Even with Python 3.10? Because I get the same error as @yaoberh.

Debug info:

Anki 2.1.49 (66689c91) Python 3.10.2 Qt 5.15.2 PyQt 5.15.6
Platform: Linux
Flags: frz=False ao=True sv=2
Add-ons, last update check: 2022-04-02 16:17:48

Support for 3.10 is available in the 2.1.50 release candidate.

1 Like