[SRU] Caught exception: aqt.dialogs.open("Preferences", self)

Bug #2015698 reported by Lyubomir
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
anki (Debian)
New
Unknown
anki (Ubuntu)
Status tracked in Oracular
Jammy
Fix Released
Medium
Unassigned
Mantic
Won't Fix
Medium
Unassigned
Noble
Fix Released
Medium
Unassigned
Oracular
Fix Released
Medium
Unassigned

Bug Description

[ Impact ]

Users will fail to open the preferences window to set their preferences.
The usual window will not be displayed instead the windows will have an error message:

Caught exception:
  File "/usr/share/anki/aqt/main.py", line 882, in onPrefs
    aqt.dialogs.open("Preferences", self)
  File "/usr/share/anki/aqt/__init__.py", line 82, in open
    instance = creator(*args)
  File "/usr/share/anki/aqt/preferences.py", line 25, in __init__
    self.setupCollection()
  File "/usr/share/anki/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'

[ Test Plan ]

install anki.
start anki
Click on Tools -> Preferences

If the package is not fixed the Prefenrences window will show the above error.

With the fixed package, we can open the Preferences window after anki has started.

Just to test anki still works:
1. Click on "Create Deck" and create a deck
2. Create a file in any folder with the content "what am I doing?;Testing SRU" or any content you want with text separated by semicolons.
3. Click on File -> Import and select the text file created in above step.
4. Click on the Deck name, and then click on "Study Now".
5. It should show the question "what am I doing?"
6. Click on "Show Answer", and it will show "Testing SRU".

[ Where problems could occur ]

The typecast to int of 'timeLim' might cause some change in the time limit if the user tries to change that value in the preferences. Since it is being divided by 60.0 so any value from 0 to 59 will result in the 'timeLim' being set to 0. So, users who are using this range of value may find the timelimit not working.

[ Other Info ]

The problem is because of the strict type checking in Python 3.10 and was fixed via https://launchpad.net/bugs/2004098
But that change missed one line in the preferences code, which resulted in this problem.

I have added this change in that old patch instead of creating a new patch.

For Jammy:
https://launchpad.net/bugs/2004098 was not fixed in Jammy even though Jammy was impacted.

[ Original Bug Description ]

This happens when trying to open Tools -> Preferences

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.7 Qt 5.15.6 PyQt 5.15.7
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
  File "/usr/share/anki/aqt/main.py", line 882, in onPrefs
    aqt.dialogs.open("Preferences", self)
  File "/usr/share/anki/aqt/__init__.py", line 82, in open
    instance = creator(*args)
  File "/usr/share/anki/aqt/preferences.py", line 25, in __init__
    self.setupCollection()
  File "/usr/share/anki/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'

ProblemType: Bug
DistroRelease: Ubuntu 22.10
Package: anki 2.1.15+dfsg-3
ProcVersionSignature: Ubuntu 5.19.0-38.39-generic 5.19.17
Uname: Linux 5.19.0-38-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.23.1-0ubuntu3
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: KDE
Date: Sun Apr 9 21:20:59 2023
InstallationDate: Installed on 2023-02-25 (43 days ago)
InstallationMedia: Kubuntu 22.10 "Kinetic Kudu" - Release amd64 (20221020)
PackageArchitecture: all
SourcePackage: anki
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Lyubomir (mystiquewolf) wrote :
Revision history for this message
Jim Muchow (jdavidm) wrote :

I have the same problem with few small version differences (for example, I am using Ubuntu 22.04-jammy). When I run anki (same version) on another box running 20.04-focal, this error does not occur.

I think the problem is due to the change in the Qt5 and/or Python versions between 20.04 and 22.04 for the same version of anki, 2.1.15 (442df9d6).

When I get the error described here, the version info is
Anki 2.1.15 (442df9d6) Python 3.10.6 Qt 5.15.3 PyQt 5.15.6

When I find the version info on my 20.04 box, I find
Anki 2.1.15 (442df9d6) Python 3.08.2 Qt 5.12.8 PyQt 5.14.1

Something changed. Are there other apps the need these new versions of Qt and/or Python?

I don't know how many ways this error occurs, but trying to open Tools->Preferences is definitely the main one. I thought I encountered it doing something else, but that doesn't seem to be the case.

I would add that I can work around the problem by using the -X option with ssh to connect from the 22.04 machine to the 20.04 machine.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anki (Ubuntu):
status: New → Confirmed
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can reproduce the issue in Oracular, Noble, Mantic and Jammy.

Changed in anki (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in anki (Ubuntu Jammy):
status: New → In Progress
Changed in anki (Ubuntu Mantic):
status: New → In Progress
Changed in anki (Ubuntu Noble):
status: New → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in anki (Ubuntu Mantic):
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in anki (Ubuntu Jammy):
assignee: nobody → Sudip Mukherjee (sudipmuk)
importance: Undecided → Medium
Changed in anki (Ubuntu Mantic):
importance: Undecided → Medium
Changed in anki (Ubuntu Noble):
importance: Undecided → Medium
Changed in anki (Ubuntu Oracular):
importance: Undecided → Medium
Changed in anki (Ubuntu Oracular):
assignee: Sudip Mukherjee (sudipmuk) → nobody
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package anki - 2.1.15+dfsg-4ubuntu2

---------------
anki (2.1.15+dfsg-4ubuntu2) oracular; urgency=medium

  * Fix crash by removing distutils usage. (LP: #2062064)
  * Fix crash with use of unexpected float. (LP: #2015698)

 -- Sudip Mukherjee <email address hidden> Thu, 27 Jun 2024 22:09:13 +0100

Changed in anki (Ubuntu Oracular):
status: Fix Committed → Fix Released
summary: - Caught exception: aqt.dialogs.open("Preferences", self)
+ [SRU] Caught exception: aqt.dialogs.open("Preferences", self)
description: updated
Changed in anki (Ubuntu Noble):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Changed in anki (Ubuntu Mantic):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Changed in anki (Debian):
status: Unknown → New
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

Uploaded and waiting for SRU review.

Changed in anki (Ubuntu Jammy):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Lyubomir, or anyone else affected,

Accepted anki into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/anki/2.1.15+dfsg-3ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in anki (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Changed in anki (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed-noble
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Hello Lyubomir, or anyone else affected,

Accepted anki into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/anki/2.1.15+dfsg-3ubuntu4.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

mantic will be eol soon

Changed in anki (Ubuntu Mantic):
status: In Progress → Won't Fix
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that anki from jammy-proposed has fixed the bug for me.

Test done:

install anki and try to open preferences and confirm that it fails to with the error.

Added jammy-proposed to apt sources.
install anki from jammy-proposed.

Confirmed that the prefenrence window now displays.

Followed the testplan and checked anki works as expected.

Package tested:

$ apt-cache policy anki
anki:
  Installed: 2.1.15+dfsg-3ubuntu0.1
  Candidate: 2.1.15+dfsg-3ubuntu0.1
  Version table:
 *** 2.1.15+dfsg-3ubuntu0.1 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 Packages
        500 http://gb.archive.ubuntu.com/ubuntu jammy-proposed/universe i386 Packages
        100 /var/lib/dpkg/status
     2.1.15+dfsg-3 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        500 http://gb.archive.ubuntu.com/ubuntu jammy/universe i386 Packages

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that anki from noble-proposed has fixed the bug for me.

Test done:

install anki and confirm that it fails to open as in #2062064

Added noble-proposed to apt sources.
install anki from noble-proposed.

Confirmed that anki now opens.
Confirmed that the prefenrence window now displays.

Followed the testplan and checked anki works as expected.

Package tested:

$ apt-cache policy anki
anki:
  Installed: 2.1.15+dfsg-3ubuntu4.1
  Candidate: 2.1.15+dfsg-3ubuntu4.1
  Version table:
 *** 2.1.15+dfsg-3ubuntu4.1 100
        100 http://gb.archive.ubuntu.com/ubuntu noble-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.1.15+dfsg-3ubuntu4 500
        500 http://gb.archive.ubuntu.com/ubuntu noble/universe amd64 Packages

tags: added: verification-done verification-done-jammy verification-done-noble
removed: verification-needed verification-needed-jammy verification-needed-noble
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for anki has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package anki - 2.1.15+dfsg-3ubuntu4.1

---------------
anki (2.1.15+dfsg-3ubuntu4.1) noble; urgency=medium

  * Fix crash by removing distutils usage. (LP: #2062064)
  * Fix crash with use of unexpected float. (LP: #2015698)

 -- Sudip Mukherjee <email address hidden> Sat, 29 Jun 2024 11:27:07 +0100

Changed in anki (Ubuntu Noble):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package anki - 2.1.15+dfsg-3ubuntu0.1

---------------
anki (2.1.15+dfsg-3ubuntu0.1) jammy; urgency=medium

  * Fix crash due to strict type checking of
    python 3.10. (LP: #2004098, #2015698)

 -- Rolf Leggewie <email address hidden> Sat, 28 Jan 2023 21:22:07 +0100

Changed in anki (Ubuntu Jammy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.