Calibre crashes at startup with AttributeError: 'NoneType' object has no attribute 'cancel'

Bug #1898904 reported by grofaty on 2020-10-07
238
This bug affects 43 people
Affects Status Importance Assigned to Milestone
calibre (Ubuntu)
Undecided
Unassigned
Focal
Undecided
Unassigned

Bug Description

On Ubuntu 20.04 few months ago I installed Calibre from Ubuntu Store official repository.

I have been using Calibre for months, but today opening it from Ubuntu Launcher and nothing happens, no error.

Executing:
calibre
from terminal and the output is:
============
Traceback (most recent call last):
  File "/usr/bin/calibre", line 20, in <module>
    sys.exit(calibre())
  File "/usr/lib/calibre/calibre/gui_launch.py", line 73, in calibre
    main(args)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 543, in main
    listener = create_listener()
  File "/usr/lib/calibre/calibre/gui2/main.py", line 514, in create_listener
    return Listener(address=gui_socket_address())
  File "/usr/lib/calibre/calibre/utils/ipc/server.py", line 110, in __init__
    self._listener._unlink.cancel()
AttributeError: 'NoneType' object has no attribute 'cancel'
============

Command:
calibre --version
outputs:
calibre (calibre 4.99.4)

I tried:
sudo apt purge calibre
sudo apt autoremove
sudo apt install calibre
but the problem is the same.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: calibre 4.99.4+dfsg+really4.12.0-1build1
ProcVersionSignature: Ubuntu 5.4.0-48.52-generic 5.4.60
Uname: Linux 5.4.0-48-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.9
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Wed Oct 7 18:07:57 2020
InstallationDate: Installed on 2019-10-23 (350 days ago)
InstallationMedia: Ubuntu 18.04.3 LTS "Bionic Beaver" - Release amd64 (20190805)
PackageArchitecture: all
SourcePackage: calibre
UpgradeStatus: Upgraded to focal on 2020-08-14 (54 days ago)
modified.conffile..etc.default.apport: [modified]
mtime.conffile..etc.default.apport: 2020-04-29T17:08:03.553351

grofaty (grofaty) wrote :
grofaty (grofaty) on 2020-10-07
summary: - Calibre does not start anymore
+ Calibre crashes at startup with "/usr/bin/calibre, line 20" error

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

Changed in calibre (Ubuntu):
status: New → Confirmed
Juanjo Benages (juanjo-benages) wrote :

I forgot to upload the patch.

The attachment "7b6416ac6522fc40f24f6baf3ca552b17a8b91d6.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Evan Huus (eapache) wrote :

Per https://bugzilla.redhat.com/show_bug.cgi?id=1840780#c2 this happens on python >= 3.8.3. As Focal ships 3.8.5 we get this bug. Juanjo linked and attached the upstream patch already, which is included in Calibre >= 4.15. Focal ships Calibre version 4.99.4 which I assume is some pre-release version of the Calibre 5 series which didn't yet include this fix. Calibre 5 is now available and presumably would also fix this issue.

summary: - Calibre crashes at startup with "/usr/bin/calibre, line 20" error
+ Calibre crashes at startup with AttributeError: 'NoneType' object has no
+ attribute 'cancel'
Evan Huus (eapache) wrote :

As a work-around for those affected, I can confirm that manually applying the upstream patch to `/usr/lib/calibre/calibre/utils/ipc/server.py` does allow Calibre to start up successfully.

grofaty (grofaty) wrote :

Evans, great thanks for info how to fix, it works fine.

I have written bash file for the users that are not so technical.

Instructions:
1. Download file patch.sh from my post.
2. Open terminal, default keyboard shortcut is: CTRL+ALT+T
3. Set execution permissions: chown 700 patch.sh
4. Execute commands: ./patch.sh
5. Then you can delete patch.sh file: rm patch.sh

Hope this helps for others too.

P.S. For non-technical users, package maintainer that has packaged original Calibre program in Ubuntu 20.04, please update the package and push it to official Ubuntu repository.

grofaty (grofaty) wrote :

Ahhh, sorry bug in instructions above in step 3 should be:
chmod 700 patch.sh

I have uploaded a patched version of calibre to a ppa: https://launchpad.net/~juanjo-benages/+archive/ubuntu/fixes

It works for me. It should work as an interim until there is an updated package in the official Ubuntu repository.

Timo Aaltonen (tjaalton) on 2020-10-14
Changed in calibre (Ubuntu):
status: Confirmed → Fix Released
Launchpad Janitor (janitor) wrote :

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

Changed in calibre (Ubuntu Focal):
status: New → Confirmed
Norbert (nrbrtx) wrote :

Patch applied. Thanks!

Hope the package in the repository will be fixed soon.

Bill (franksmcb) (franksmcb) wrote :

Applied patch and can confirm it resolves the issue.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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