Calibre stopped working after upgrade

Asked by William Pabon on 2020-10-08

Hi!:
Recently I upgraded my system to Ubuntu 20.04.1 (from 18.04) and after that, Calibre (E-book library management app) stopped working. I tried removing and re-installing it to no avail: the program installs but it doesn't run. I launched it from terminal and this is what I get:

williepabon@williepabon-Macmini:~$ sudo -i
[sudo] password for williepabon:
root@williepabon-Macmini:~# calibre
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
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'
root@williepabon-Macmini:~#

If anybody understands the stuff above and can help me to find a solution, will be greatly appreciated. Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
2020-10-09
Last query:
2020-10-09
Last reply:
2020-10-09
William Pabon (williepabon) said : #2

Daniel:

Thanks for answering. The link above says that there is a patch to solve the problem. How do I implement it? Please, advice.

Why are you running Calibre as root?

Best Manfred Hampl (m-hampl) said : #4

Try the following:

Open a terminal window (e.g. by simultaneously pressing ctrl-alt-t)
issue the command

sudo gedit /usr/lib/calibre/calibre/utils/ipc/server.py

This will ask for your password as confirmation for an administrative action and will then open an editor with a python script loaded.

Scroll down to line 110

change
            # named sockets, prevent it from doing so.
            self._listener._unlink.cancel()
            # Prevent child processes from inheriting this socket

into
            # named sockets, prevent it from doing so.
            if self._listener._unlink is not None:
                self._listener._unlink.cancel()
            # Prevent child processes from inheriting this socket

(by indenting the line "self.listener..." and adding an "if ..." before).
Correct indentation is crucial!

When you have done this, save the file and close the editor.

In case that you botch everything up, you can restore the previous status with the command
sudo apt install --reinstall calibre
and then you can try again.

William Pabon (williepabon) said : #5

Thanks Manfred Hampl, that solved my question.