Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 869917 - app-misc/anki-2.1.15-r1: Error when opening preferences
Summary: app-misc/anki-2.1.15-r1: Error when opening preferences
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: Patrick Lauer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-12 23:07 UTC by mphi
Modified: 2023-08-12 16:28 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch (qt-setValue-float.patch,605 bytes, patch)
2023-04-23 23:32 UTC, WGH
Details | Diff
Patch for deck options (anki-2.1.15-deck-options.patch,1.25 KB, patch)
2023-08-12 16:28 UTC, silver_ghost
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mphi 2022-09-12 23:07:31 UTC
When I open the Preferences I get the error below [1].

Searching for this error online yields 2 search results from the anki forum which imply that updating to the recent version will fix that (see [2], [3]).


[1]
###

Anki 2.1.15 (442df9d6) Python 3.10.6 Qt 5.15.5 PyQt 5.15.6
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
  File "/usr/lib/python3.10/site-packages/aqt/main.py", line 881, in onPrefs
    aqt.dialogs.open("Preferences", self)
  File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 82, in open
    instance = creator(*args)
  File "/usr/lib/python3.10/site-packages/aqt/preferences.py", line 25, in __init__
    self.setupCollection()
  File "/usr/lib/python3.10/site-packages/aqt/preferences.py", line 80, in setupCollection
    f.lrnCutoff.setValue(qc['collapseTime']/60.0)
<class 'TypeError'>: setValue(self, int): argument 1 has unexpected type 'float'

[2]
###
https://forums.ankiweb.net/t/bugreport-anki-desktop-at-fedora-35/14635

[3]
###
https://forums.ankiweb.net/t/unexpected-type-float/22797

Reproducible: Always

Steps to Reproduce:
1. Install app-misc/anki-2.1.15-r1
2. Open Application, language English
3. Tools ⇾ Preferences

Actual Results:  
Error 
An error occurred. Please use Tools > Check Database to see if that fixes the problem. 
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.15 (442df9d6) Python 3.10.6 Qt 5.15.5 PyQt 5.15.6
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
  File "/usr/lib/python3.10/site-packages/aqt/main.py", line 881, in onPrefs
    aqt.dialogs.open("Preferences", self)
  File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 82, in open
    instance = creator(*args)
  File "/usr/lib/python3.10/site-packages/aqt/preferences.py", line 25, in __init__
    self.setupCollection()
  File "/usr/lib/python3.10/site-packages/aqt/preferences.py", line 80, in setupCollection
    f.lrnCutoff.setValue(qc['collapseTime']/60.0)
<class 'TypeError'>: setValue(self, int): argument 1 has unexpected type 'float'

Expected Results:  
It opens the preferences window.

Software recommends to "Check database" — does unsurprisingly not work.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-13 15:50:32 UTC
I think this is essentially a duplicate of bug 782373 for the version bump part, so dropping that from summary.
Comment 2 WGH 2023-04-23 23:32:21 UTC
This was fixed upstream here: https://github.com/ankitects/anki/commit/d2ae874d9e1615d09afc912275cc3b27776a1392. The patch doesn't apply as is because the code has changed a bit, but it still was easy to backport.
Comment 3 WGH 2023-04-23 23:32:56 UTC
Created attachment 860676 [details, diff]
patch
Comment 4 Larry the Git Cow gentoo-dev 2023-06-13 21:29:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bd2f4e45cae5ffb8cdab1f2942312b49497e24a

commit 5bd2f4e45cae5ffb8cdab1f2942312b49497e24a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-06-13 21:28:53 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-13 21:29:27 +0000

    app-misc/anki: update EAPI 7 -> 8, enable py3.11, fix prefs
    
    Thanks to WGH for the backport of the pref fix.
    
    Closes: https://bugs.gentoo.org/869917
    Closes: https://bugs.gentoo.org/896566
    Signed-off-by: Sam James <sam@gentoo.org>

 app-misc/anki/anki-2.1.15-r2.ebuild             | 95 +++++++++++++++++++++++++
 app-misc/anki/files/anki-2.1.15-fix-prefs.patch | 17 +++++
 2 files changed, 112 insertions(+)
Comment 5 silver_ghost 2023-08-08 13:31:28 UTC
Same error for Deck Preferences.

Steps to Reproduce:
1. Install app-misc/anki-2.1.15-r2
2. Open Application, language English
3. Click on a gear by any deck -> select Options
4. Get this error message:
Error 
An error occurred. Please use Tools > Check Database to see if that fixes the problem. 
If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.
Anki 2.1.15 (442df9d6) Python 3.11.4 Qt 5.15.9 PyQt 5.15.9
Platform: Linux
Flags: frz=False ao=False sv=2

Caught exception:
  File "/usr/lib/python3.11/site-packages/aqt/deckbrowser.py", line 213, in <lambda>
    a.triggered.connect(lambda b, did=did: self._options(did))
                                           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/aqt/deckbrowser.py", line 242, in _options
    self.mw.onDeckConf()
  File "/usr/lib/python3.11/site-packages/aqt/main.py", line 868, in onDeckConf
    aqt.deckconf.DeckConf(self, deck)
  File "/usr/lib/python3.11/site-packages/aqt/deckconf.py", line 25, in __init__
    self.setupConfs()
  File "/usr/lib/python3.11/site-packages/aqt/deckconf.py", line 49, in setupConfs
    self.loadConfs()
  File "/usr/lib/python3.11/site-packages/aqt/deckconf.py", line 66, in loadConfs
    self.onConfChange(startOn)
  File "/usr/lib/python3.11/site-packages/aqt/deckconf.py", line 89, in onConfChange
    self.loadConf()
  File "/usr/lib/python3.11/site-packages/aqt/deckconf.py", line 175, in loadConf
    f.lrnFactor.setValue(c['initialFactor']/10.0)
<class 'TypeError'>: setValue(self, val: int): argument 1 has unexpected type 'float'
Comment 6 silver_ghost 2023-08-12 16:28:45 UTC
Created attachment 867722 [details, diff]
Patch for deck options