Bug 1840290

Summary: Calibre fails to start - AttributeError: 'NoneType' object has no attribute 'cancel'
Product: [Fedora] Fedora Reporter: Thomas Lake <tom>
Component: calibreAssignee: Kevin Fenzi <kevin>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: chkr, enpontus, helio, kevin, k_stambaugh, nushio, spillner, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-29 22:45:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Lake 2020-05-26 17:04:30 UTC
Description of problem: Calibre fails to launch

Version-Release number of selected component (if applicable):
calibre-4.13.0-1.fc32.x86_64

Steps to Reproduce:
1. Launch Calibre from application list or by running 'calibre' from a shell

Actual results:

QSocketNotifier: Can only be used with threads started with QThread
Traceback (most recent call last):
  File "/usr/bin/calibre", line 20, in <module>
    sys.exit(calibre())
  File "/usr/lib64/calibre/calibre/gui_launch.py", line 72, in calibre
    main(args)
  File "/usr/lib64/calibre/calibre/gui2/main.py", line 542, in main
    listener = create_listener()
  File "/usr/lib64/calibre/calibre/gui2/main.py", line 513, in create_listener
    return Listener(address=gui_socket_address())
  File "/usr/lib64/calibre/calibre/utils/ipc/server.py", line 109, in __init__
    self._listener._unlink.cancel()
AttributeError: 'NoneType' object has no attribute 'cancel'


Expected results:

GUI starts

Additional info:
"QSocketNotifier" line appears to be unrelated

Bug appears to be fixed upstream in v4.15.0 (commmit 7b6416ac6522fc40f24f6baf3ca552b17a8b91d6)

Comment 1 Kevin Fenzi 2020-05-29 22:45:59 UTC

*** This bug has been marked as a duplicate of bug 1840780 ***

Comment 2 Kyle 2020-10-15 00:32:23 UTC
I am encountering this exact same bug, I have the latest update of calibre... can someone please explain further how to fix this bug?

Comment 3 Brent 2020-10-18 00:57:17 UTC
The answer is buried in the thread on the duplicate bug (# 1840780), but to save you time, the patch is at https://github.com/kovidgoyal/calibre/commit/7b6416ac6522fc40f24f6baf3ca552b17a8b91d6.  Edit your /usr/lib/calibre/calibre/utils/ipc/server.py (or wherever you have it installed, try "locate ipc/server.py" to find the path) to check the time of self._listener._unlink before calling its cancel() method, as shown in the GitHub patch.

Alternatively, it sounds like downgrading Python to an older version or upgrading Calibre to a newer one may take care of the issue, but this is a quick and easy fix with negligible risk of upsetting anything else, if you're not prepared to abandon your distro's default Python/Calibre packages.