Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load DeDRM_calibre_plugin with calibre 4.1 on Fedora 31 #928

Closed
xjvs opened this issue Oct 31, 2019 · 21 comments
Closed

Unable to load DeDRM_calibre_plugin with calibre 4.1 on Fedora 31 #928

xjvs opened this issue Oct 31, 2019 · 21 comments

Comments

@xjvs
Copy link

xjvs commented Oct 31, 2019

Hi,

I'm running calibre 4.1 on Fedora 31 which has Python3 as default, while loading "DeDRM_plugin.zip", I got error messages as below:

calibre, version 4.1.0
ERROR: Unhandled exception: <b>SyntaxError</b>:invalid syntax (calibre_plugins.dedrm.__init__, line 167)

calibre 4.1  embedded-python: False is64bit: True
Linux-5.3.7-301.fc31.x86_64-x86_64-with-fedora-31-Thirty_One Linux ('64bit', 'ELF')
('Linux', '5.3.7-301.fc31.x86_64', '#1 SMP Mon Oct 21 19:18:58 UTC 2019')
Python 3.7.4
Linux: ('Fedora', '31', 'Thirty One')
Interface language: en_GB
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/preferences/plugins.py", line 318, in add_plugin
    plugin = add_plugin(path)
  File "/usr/lib64/calibre/calibre/customize/ui.py", line 472, in add_plugin
    plugin = load_plugin(path_to_zip_file)
  File "/usr/lib64/calibre/calibre/customize/ui.py", line 61, in load_plugin
    return loader.load(path_to_zip_file)
  File "/usr/lib64/calibre/calibre/customize/zipplugin.py", line 202, in load
    m = importlib.import_module(plugin_module)
  File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/usr/lib64/calibre/calibre/customize/zipplugin.py", line 180, in load_module
    import_name), 'exec', dont_inherit=True)
  File "calibre_plugins.dedrm.__init__", line 167
    print u"{0} v{1}: Copying needed library files from plugin's zip".format(PLUGIN_NAME, PLUGIN_VERSION)
                                                                    ^
SyntaxError: invalid syntax

And this is the calibre info:

$ calibre-debug -g
QSocketNotifier: Can only be used with threads started with QThread
calibre 4.1  embedded-python: False is64bit: True
Linux-5.3.7-301.fc31.x86_64-x86_64-with-fedora-31-Thirty_One Linux ('64bit', 'ELF')
('Linux', '5.3.7-301.fc31.x86_64', '#1 SMP Mon Oct 21 19:18:58 UTC 2019')
Python 3.7.4
Linux: ('Fedora', '31', 'Thirty One')
Interface language: en_GB
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 157.31612903225806 x 161.36470588235292
Using calibre Qt style: True

It seems the DeDRM plugin only support python2, is there a workaround for me to load and enable the plugin? Fedora 31 has Python3.7 as default, but Python2.7 is also available.

@j-howell
Copy link

j-howell commented Oct 31, 2019

I don’t know about the DeDRM plugin in particular, but Calibre is currently a python 2 application. Work is underway to make it Python 3 compliant, but it is not yet complete and I suspect that many plugins won’t be updated until Calibre itself is ready.

See https://calibre-ebook.com/download_linux for info about installing under Linux.

@xjvs
Copy link
Author

xjvs commented Nov 1, 2019

I don’t know about the DeDRM plugin in particular, but Calibre is currently a python 2 application. Work is underway to make it Python 3 compliant, but it is not yet complete and I suspect that many plugins won’t be updated until Calibre itself is ready.

This is not true, Calibre already supports Python 3, at least on my system (Fedora 31) Calibre 4.1 is built and running with Python 3.

Seems there is no workaround to load DeDRM from Python 3 Calibre. Hi DeDRM maintainers, is there any plan on supporting Python 3 for DeDRM_calibre_plugin?

@rrix
Copy link

rrix commented Nov 3, 2019

Doing nothing but running 2to3 on the codebase provides nearly 9000 lines in changes, this doesn't seem like a trivial undertaking to actually get it working.

I guess a work around would be to try to get a calibre flatpak running it under py2 ? I don't know if the hardware support would work though.

@audetto
Copy link

audetto commented Nov 7, 2019

I can only confirm it.
And installing the F30 rpm does not work either.

@audetto
Copy link

audetto commented Nov 7, 2019

It is massive pain, but boxes and F30 came to the rescue.

@voland66
Copy link

DeDRM plugin works on fedora 31 with calibre 3.48.0 installed. The rpm from F30 does not run but a binary install with the command below works:

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin install_dir=/usr/local version=3.48.0

@acdingman
Copy link

acdingman commented Dec 4, 2019

Similar results with Calibre 4.5 on Fedora 31 with Python 3.

calibre, version 4.5.0
ERROR: Unhandled exception: SyntaxError:invalid syntax (calibre_plugins.dedrm.init, line 167)

calibre 4.5 embedded-python: False is64bit: True
Linux-5.3.9-300.fc31.x86_64-x86_64-with-fedora-31-Thirty_One Linux ('64bit', 'ELF')
('Linux', '5.3.9-300.fc31.x86_64', '#1 SMP Wed Nov 6 16:13:19 UTC 2019')
Python 3.7.5
Linux: ('Fedora', '31', 'Thirty One')
Interface language: None
Successfully initialized third party plugins: KePub Input (3, 0, 0) && KePub Metadata Reader (3, 0, 2)
Traceback (most recent call last):
File "/usr/lib64/calibre/calibre/gui2/preferences/plugins.py", line 318, in add_plugin
plugin = add_plugin(path)
File "/usr/lib64/calibre/calibre/customize/ui.py", line 472, in add_plugin
plugin = load_plugin(path_to_zip_file)
File "/usr/lib64/calibre/calibre/customize/ui.py", line 61, in load_plugin
return loader.load(path_to_zip_file)
File "/usr/lib64/calibre/calibre/customize/zipplugin.py", line 200, in load
reload(m)
File "/usr/lib64/calibre/polyglot/builtins.py", line 113, in reload
return importlib.reload(module)
File "/usr/lib64/python3.7/importlib/init.py", line 169, in reload
_bootstrap._exec(spec, module)
File "", line 628, in _exec
File "/usr/lib64/calibre/calibre/customize/zipplugin.py", line 180, in load_module
import_name), 'exec', dont_inherit=True)
File "calibre_plugins.dedrm.init", line 167
print u"{0} v{1}: Copying needed library files from plugin's zip".format(PLUGIN_NAME, PLUGIN_VERSION)
^
SyntaxError: invalid syntax

@mlturner88
Copy link

It is massive pain, but boxes and F30 came to the rescue.

@audetto did you find a workaround? If so, what was your solution?

@hevanaa
Copy link

hevanaa commented Dec 23, 2019

It is massive pain, but boxes and F30 came to the rescue.

I also installed F30 in Boxes. That is quite an easy workaround as workarounds goes. I guess some of us experiencing most pain will eventually start porting the python 2 code...

@hevanaa
Copy link

hevanaa commented Dec 23, 2019

And there is already a Py3 conversion going on: #931

@rrix
Copy link

rrix commented Dec 31, 2019

The Flatpak image on flathub works with OBOK without special configuration:

rrix@tres-ebow:~ :) flatpak info com.calibre_ebook.calibre

Calibre - E-book manager

          ID: com.calibre_ebook.calibre
         Ref: app/com.calibre_ebook.calibre/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 4.7
     License: GPL-3.0
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 353.5 MB
     Runtime: org.freedesktop.Platform/x86_64/19.08
         Sdk: org.freedesktop.Sdk/x86_64/19.08

      Commit: 5128ea0a3d02dae21326099915f8ae6a49f3a70fc282fbf5dc744142ca944804
      Parent: cb0cab74302066b972572e1537ee66f87d035763e3dee1de9764382c101d6643
     Subject: update calibre to 4.7 (c1e01358)
        Date: 2019-12-27 16:16:44 +0000
@hevanaa
Copy link

hevanaa commented Dec 31, 2019

That's great information and I might end up installing it (even though a voice within me whispers that developers and users are becoming lazy when they prefer keeping and installing old frameworks and blobs, filling up our hard disks with redundant libraries within flatpaks, snaps and appimages, and hindering progress). - insert old man yells at cloud image here -

@rrix
Copy link

rrix commented Jan 7, 2020

(even though a voice within me whispers that developers and users are becoming lazy when they prefer keeping and installing old frameworks and blobs, filling up our hard disks with redundant libraries within flatpaks, snaps and appimages, and hindering progress). - insert old man yells at cloud image here -

There's ongoing work to port the library to py3k, this has been fine in the interim. :)

@racoco
Copy link

racoco commented Apr 4, 2020

I am running FC-31 and Calibre 4.12.0.
I also experienced the same issue as acdingman when attempting to install the DeDRM_plugin.zip (it is v6.6.3): exception got thrown on line 167 of the init.py file inside the zip bundle.

[But I was able to successfully install the other recommended plugin: kfx-input.zip]

Looking at that line of code, I commented it out (it's just a print statement after all) to see what would happen. Well, a similar print statement on line 179 threw an exception. Unfortunately, it was inside an exception handling block so clearly I was screwed. I could not figure out what was wrong, so I googled this issue and found this and other pages.

Reading it all, it seemed clear that the issue had to do with Calibre and Python 3 incompatibilities and that there was nothing to be done until the Calibre folks addressed the issue.

Out of curiosity, I imported the AZW4 Kindle Fire file for the Kindle eBook I recently bought. The import succeeded w/o incident, so I took the next step of converting it to PDF expecting to see decryption errors of some type.

WTF!!! It worked!!!

I have no idea why. Maybe something in the kfx-input plugin? Maybe the Kindle file I purchased was not encrypted? Dunno, but I got what I wanted and don't wish to make a career over the DeDRM plugin issue.

Has Amazon stopped encrypting their Kindle books?
Everything I see online wrt turning Amazon Kindle content to another format talks about using Calibre and the DeDRM plugin. I didn't seem to need DeDRM!

Just thought I'd pass this on.
Would be happy to hear an explanation if someone has one.

Rich

@ElleKayEm
Copy link

As I said in the other issue, that book must have already been DRM-free. Some publishers allow their books to be sold without it. Most of the big publisher still require it though.

@racoco
Copy link

racoco commented Apr 5, 2020

ElleKayEm - thank you.

@ghost
Copy link

ghost commented Oct 20, 2020

For anyone still trying to get this to work. Installing Calibre from the tarball worked for me on Fedora 32.

Download the calibre tarball. https://download.calibre-ebook.com/3.48.0/

Then install it. Change the path of course.

sudo mkdir -p /opt/calibre && sudo rm -rf /opt/calibre/* && sudo tar xvf /path/to/downloaded/calibre-tarball.txz -C /opt/calibre && sudo /opt/calibre/calibre_postinstall

Then go through the process of installing the deDRM plugin. I installed version 6.8.

@ElleKayEm
Copy link

You can go up to calibre 4.23 with DeDRM 6.8.

@strarsis
Copy link

strarsis commented Nov 2, 2020

+1, this bug occurs with latest Calibre 5.x! Can't use DeDRM in Calibre 5.4.2.

@ElleKayEm
Copy link

@strarsis
Yes, it is known. Calibre 5.x compatibility is being worked on. In the meantime, use calibre 4.23.

@apprenticeharper
Copy link
Owner

Try the 7.0.0 betas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet