JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UI not loading after updating to Ubuntu 24.04

jedsmith13 opened this issue · comments

After updating to Ubuntu 24.04 I can no longer see the FFF UI.

I get this in the debug log:

calibre_plugins.fictiondb.__init__:60: SyntaxWarning: invalid escape sequence '\.'
ApplicationPaletteChange event ignored
Using calibre Qt style: True
Traceback (most recent call last):
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/requests_toolbelt/_compat.py", line 48, in <module>
    from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/usr/lib/python3/dist-packages/urllib3/contrib/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 141, in __init__
    ac = self.init_iaction(action)
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 159, in init_iaction
    ac = action.load_actual_plugin(self)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.fanficfare_plugin.__init__", line 121, in load_actual_plugin
    return InterfaceActionBase.load_actual_plugin(self,gui)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/__init__.py", line 662, in load_actual_plugin
    ac = getattr(importlib.import_module(mod), cls)(gui,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 207, in exec_module
    exec(compiled, module.__dict__)
  File "calibre_plugins.fanficfare_plugin.fff_plugin", line 77, in <module>
    from fanficfare import adapters, exceptions
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/fanficfare/adapters/__init__.py", line 29, in <module>
    from .. import configurable as configurable
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/fanficfare/configurable.py", line 42, in <module>
    from . import fetchers
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/fanficfare/fetchers/__init__.py", line 19, in <module>
    from .fetcher_cloudscraper import CloudScraperFetcher
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/fanficfare/fetchers/fetcher_cloudscraper.py", line 22, in <module>
    import cloudscraper
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/cloudscraper/__init__.py", line 14, in <module>
    from requests_toolbelt.utils import dump
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/requests_toolbelt/__init__.py", line 12, in <module>
    from .adapters import SSLAdapter, SourceAddressAdapter
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/requests_toolbelt/adapters/__init__.py", line 12, in <module>
    from .ssl import SSLAdapter
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/requests_toolbelt/adapters/ssl.py", line 16, in <module>
    from .._compat import poolmanager
  File "/home/jsmith/.config/calibre/plugins/FanFicFare.zip/requests_toolbelt/_compat.py", line 50, in <module>
    from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/lib/python3/dist-packages/urllib3/contrib/__init__.py)
EpubMerge: DEBUG: 2024-06-05 09:28:28,034: calibre_plugins.epubmerge.epubmerge_plugin(156): macmenuhack file_path:/home/jsmith/.config/calibre/plugins/fanficfare_macmenuhack.txt
calibre Debug log
calibre 7.6  embedded-python: False
Linux-6.8.0-35-generic-x86_64-with-glibc2.39 Linux ('64bit', 'ELF')
('Linux', '6.8.0-35-generic', '#35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024')
Python 3.12.3
Interface language: None
EXE path: /usr/bin/python3.12
Successfully initialized third party plugins: EpubMerge (2, 18, 0) && FanFicFare (4, 35, 0) && FictionDB (1, 4, 2) && Generate Cover (2, 3, 4) && LanguageTool (0, 1, 3) && Reading List (1, 15, 4) && Search The Internet (1, 11, 2)
calibre 7.6  embedded-python: False
Linux-6.8.0-35-generic-x86_64-with-glibc2.39 Linux ('64bit', 'ELF')
('Linux', '6.8.0-35-generic', '#35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024')
Python 3.12.3
Interface language: None
EXE path: /usr/bin/python3.12
Successfully initialized third party plugins: EpubMerge (2, 18, 0) && FanFicFare (4, 35, 0) && FictionDB (1, 4, 2) && Generate Cover (2, 3, 4) && LanguageTool (0, 1, 3) && Reading List (1, 15, 4) && Search The Internet (1, 11, 2)
QPA platform: xcb
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 60.959999999999994 x 60.959999999999994
[0.00] Starting up...
[0.01] Showing splash screen...
[0.09] splash screen shown
[0.09] Initializing db...
[0.11] db initialized
[0.11] Constructing main UI...
[0.76] GUI main window shown
[0.81] main UI initialized...
[0.81] Hiding splash screen

Seeing the issue was related to requests_toolbelt I updated my version using sudo apt install python3-requests-toolbelt which set it to version 1.0.0-2.

It still doesn't show the UI but now gives me this in the debug log:

calibre_plugins.fictiondb.__init__:60: SyntaxWarning: invalid escape sequence '\.'
ApplicationPaletteChange event ignored
Using calibre Qt style: True
EpubMerge: DEBUG: 2024-06-05 09:37:47,938: calibre_plugins.epubmerge.epubmerge_plugin(156): macmenuhack file_path:/home/jsmith/.config/calibre/plugins/fanficfare_macmenuhack.txt
FFF: DEBUG: 2024-06-05 09:37:47,944: calibre_plugins.fanficfare_plugin.fff_plugin(217): Plugin FanFicFare macmenuhack file_path:/home/jsmith/.config/calibre/plugins/fanficfare_macmenuhack.txt
calibre Debug log
calibre 7.6  embedded-python: False
Linux-6.8.0-35-generic-x86_64-with-glibc2.39 Linux ('64bit', 'ELF')
('Linux', '6.8.0-35-generic', '#35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024')
Python 3.12.3
Interface language: None
EXE path: /usr/bin/python3.12
Successfully initialized third party plugins: EpubMerge (2, 18, 0) && FanFicFare (4, 35, 0) && FictionDB (1, 4, 2) && Generate Cover (2, 3, 4) && LanguageTool (0, 1, 3) && Reading List (1, 15, 4) && Search The Internet (1, 11, 2)
calibre 7.6  embedded-python: False
Linux-6.8.0-35-generic-x86_64-with-glibc2.39 Linux ('64bit', 'ELF')
('Linux', '6.8.0-35-generic', '#35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024')
Python 3.12.3
Interface language: None
EXE path: /usr/bin/python3.12
Successfully initialized third party plugins: EpubMerge (2, 18, 0) && FanFicFare (4, 35, 0) && FictionDB (1, 4, 2) && Generate Cover (2, 3, 4) && LanguageTool (0, 1, 3) && Reading List (1, 15, 4) && Search The Internet (1, 11, 2)
QPA platform: xcb
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 60.959999999999994 x 60.959999999999994
[0.00] Starting up...
[0.00] Showing splash screen...
[0.05] splash screen shown
[0.05] Initializing db...
[0.07] db initialized
[0.07] Constructing main UI...
[1.19] GUI main window shown
[1.25] main UI initialized...
[1.25] Hiding splash screen

The second debug log shows the plugin loaded successfully. I would try adding to the UI again, although Calibre doesn't usually remove plugins that fail to load.

As a general rule, I only support FFF on the official calibre releases for exactly this sort of reason--random dependencies being a problem. The vendor versions are typically out of date, too--current is Calibre 7.12.

So officially, my answer is to install the official calibre releases. Come back if it still fails on the official version.

I ran into the same problem on Debian Sid earlier today.

The cause was that the python3-urllib3 package in sid had recently been upgraded to version 2.0.7 (python3-urllib3_2.0.7-2_all.deb).

I downgraded the package to version 1.26 (python3-urllib3_1.26.18-2_all.deb) and, after restarting calibre, FFF started working again. I didn't try installing the python3-requests-toolbelt package.

I guess at some point, FFF will be made compatible with the newer urllib3. Until then, I've run apt-mark hold python3-urllib3 so it won't be auto-upgraded - this may eventually cause other problems with python apps on my system, but I'll deal with that if and when it happens.

No need to re-open the issue, I just posted this in the hope that the info is useful for anyone else who encounters this problem.