apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.55k stars 1.52k forks source link

Invalid Plugin does not contain top-level init.py file #1076

Open bporourke2 opened 4 years ago

bporourke2 commented 4 years ago

I tried to install the plug in but get the following error.

calibre, version 4.14.0 ERROR: Unhandled exception: InvalidPlugin:The plugin in u'C:\Users\l[user]\Downloads\DeDRM_tools-master\DeDRM_tools-master\Obok_plugin.zip' is invalid. It does not contain a top-level init.py file

calibre 4.14 embedded-python: True is64bit: False Windows-10-10.0.18362-SP0 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.18362') Python 2.7.16+ Windows: ('10', '10.0.18362', 'SP0', u'Multiprocessor Free') Interface language: None Traceback (most recent call last): File "site-packages\calibre\gui2\preferences\plugins.py", line 319, in add_plugin File "site-packages\calibre\customize\ui.py", line 472, in add_plugin File "site-packages\calibre\customize\ui.py", line 61, in load_plugin File "site-packages\calibre\customize\zipplugin.py", line 194, in load File "site-packages\calibre\customize\zipplugin.py", line 292, in _locate_code InvalidPlugin: The plugin in u'C:\Users\[user]\Downloads\DeDRM_tools-master\DeDRM_tools-master\Obok_plugin.zip' is invalid. It does not contain a top-level init.py file

Before you try to tell me I am installing the whole directory, I am not. I unzipped the DeDRM_tools-master.zip and then within that folder there is the folder "DeDRM_tools-master folder, and within that folder there is a subfolder named "DeDRM_plugin". I tried to add that folder but it is not a zip so that didnt work. I zipped the folder and then tried to install from that to no avail. I still get the same probelm, even though there is a init.py file.

The file below shows the main file directory within DeDRM_plugin download. I zipped the 2 zip files myself.

Does anyone have an idea of what to do?

image

ElleKayEm commented 4 years ago

Download DeDRM_tools_6.7.0.zip from here:

https://github.com/apprenticeharper/DeDRM_tools/releases/tag/v6.7.0

DC7IA commented 4 years ago

Seemingly same issue on Ubuntu 20.04

calibre, version 4.99.4
FEHLER: Unbehandelter Ausnahmefehler: <b>SyntaxError</b>:invalid syntax (calibre_plugins.dedrm.__init__, line 168)

calibre 4.99.4  embedded-python: False is64bit: True
Linux-5.4.0-28-generic-x86_64-with-glibc2.29 Linux ('64bit', 'ELF')
('Linux', '5.4.0-28-generic', '#32-Ubuntu SMP Wed Apr 22 17:40:10 UTC 2020')
Python 3.8.2
Interface language: de
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 31, 0) && Package KFX (from KFX Input) (1, 31, 0) && KFX metadata reader (from KFX Input) (1, 31, 0) && KFX Input (1, 31, 0)
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/preferences/plugins.py", line 319, in add_plugin
    plugin = add_plugin(path)
  File "/usr/lib/calibre/calibre/customize/ui.py", line 472, in add_plugin
    plugin = load_plugin(path_to_zip_file)
  File "/usr/lib/calibre/calibre/customize/ui.py", line 61, in load_plugin
    return loader.load(path_to_zip_file)
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 200, in load
    reload(m)
  File "/usr/lib/calibre/polyglot/builtins.py", line 123, in reload
    return importlib.reload(module)
  File "/usr/lib/python3.8/importlib/__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 602, in _exec
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 179, in load_module
    compiled = compile(code, 'calibre_plugins.%s.%s'%(plugin_name,
  File "calibre_plugins.dedrm.__init__", line 168
    print u"{0} v{1}: Copying needed library files from plugin's zip".format(PLUGIN_NAME, PLUGIN_VERSION)
          ^
SyntaxError: invalid syntax
ElleKayEm commented 4 years ago

Opening post was trying to install the wrong file. Different issue here. Not compatible with Python 3 yet.

AdmiralWright commented 4 years ago

Having the same issue trying to load the DeDRM plugin on Calibre 4.15 for Mac (Mojave).

calibre, version 4.15.0 ERROR: Unhandled exception: InvalidPlugin:The plugin in u'/Users/xxxxxx/Downloads/DeDRM_tools_6.7.0(1)/DeDRM_Plugin.zip' is invalid. It does not contain a top-level init.py file

calibre 4.15 embedded-python: True is64bit: True Darwin-18.7.0-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '18.7.0', 'Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64') Python 2.7.16 OSX: ('10.14.6', ('', '', ''), 'x86_64') Interface language: None Traceback (most recent call last): File "site-packages/calibre/gui2/preferences/plugins.py", line 319, in add_plugin File "site-packages/calibre/customize/ui.py", line 472, in add_plugin File "site-packages/calibre/customize/ui.py", line 61, in load_plugin File "site-packages/calibre/customize/zipplugin.py", line 194, in load File "site-packages/calibre/customize/zipplugin.py", line 292, in _locate_code InvalidPlugin: The plugin in u'/Users/xxxxxx/Downloads/DeDRM_tools_6.7.0(1)/DeDRM_Plugin.zip' is invalid. It does not contain a top-level init.py file

ElleKayEm commented 4 years ago

Hmmm, it looks like you're loading the correct file and that should work. Give it another try?

Download DeDRM_tools_6.7.0.zip from here:

https://github.com/apprenticeharper/DeDRM_tools/releases/tag/v6.7.0

Unzip DeDRM_tools_6.7.0.zip. Then load DeDRM_plugin.zip.

AdmiralWright commented 4 years ago

The link is where I got it from. Just tried loading it again. Same error.

ElleKayEm commented 4 years ago

Unzip DeDRM_tools_6.7.0.zip. Then when you load DeDRM_plugin.zip into calibre, make sure you are navigating to the folder DeDRM_tools_6.7.0 and not to the still zipped archive with the same name.

AdmiralWright commented 4 years ago

Still getting the same thing. Bummed out. :(

ElleKayEm commented 4 years ago

After you unzip DeDRM_tools_6.7.0.zip, rename the unzipped folder something like "unzipped DeDRM tools". Do not unzip DeDRM_plugin.zip. Then be sure you're loading DeDRM_plugin.zip from inside that renamed folder.

tar-asiy commented 4 years ago

Hi! I've got a quite similar error message on Ubuntu 20.04 as one described above. Does it also have to do with the Python 3 compatibility issue or is it something else? And if it's this issue what are prospects to get the compatibility soon? Or I just need to switch back to a python2 version in order to install the plugin?

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

calibre 4.99.4 embedded-python: False is64bit: True Linux-5.4.0-37-generic-x86_64-with-glibc2.29 Linux ('64bit', 'ELF') ('Linux', '5.4.0-37-generic', '#41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020') Python 3.8.2 Interface language: None Successfully initialized third party plugins: Obok DeDRM (6, 7, 0) Traceback (most recent call last): File "/usr/lib/calibre/calibre/gui2/preferences/plugins.py", line 319, in add_plugin plugin = add_plugin(path) File "/usr/lib/calibre/calibre/customize/ui.py", line 472, in add_plugin plugin = load_plugin(path_to_zip_file) File "/usr/lib/calibre/calibre/customize/ui.py", line 61, in load_plugin return loader.load(path_to_zip_file) File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 202, in load m = importlib.import_module(plugin_module) File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 618, in _load_backward_compatible File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 179, in load_module compiled = compile(code, 'calibre_plugins.%s.%s'%(plugin_name, File "calibre_plugins.dedrm.init", line 168 print u"{0} v{1}: Copying needed library files from plugin's zip".format(PLUGIN_NAME, PLUGIN_VERSION) ^ SyntaxError: invalid syntax

ElleKayEm commented 4 years ago

Yes, your issue is because you're using a version of calibre with Python 3. Python 3 compatibility is being worked on. You can look at the threads here discussing it. In the meantime, I believe calibre-ebook.com and flathub.org still have Python 2 versions of calibre.

kend650 commented 4 years ago

Any idea of when the Python 3 version will be available? 1 Month, 1 year, ???

ElleKayEm commented 4 years ago

This is a community garden. If you want tomatoes, you're welcome to start digging.

ElleKayEm commented 4 years ago

@74256274

Use calibre 4.23 and DeDRM 6.8.0. Make sure you are unzipping the main archive and loading just DeDRM_Plugin.zip into calibre.

Yolakalemowa commented 2 years ago

Looks like this issue has been resolved... latest DeDRM (7.2.1) is compatible with latest Calibre (5.39.1)

ElleKayEm commented 2 years ago

DeDRM has been compatible with calibre 5.x for a year or so now. Find the latest over here: https://github.com/noDRM/DeDRM_tools

sheepdoggie commented 8 months ago

I have this problem while using Calibre 7.5.1. I have tried to install DeDRM plugin 6.7.0, 7.2.1 and 10.0.3. All of the DeDRM fail to install with the message:

calibre, version 7.5.1 ERROR: Unhandled exception: InvalidPlugin:The plugin in '/home/mel/Downloads/DeDRM_tools_10.0.3.zip' is invalid. It does not contain a top-level init.py file

calibre 7.5.1 embedded-python: True Linux-5.15.0-94-generic-x86_64-with-glibc2.31 Linux ('64bit', 'ELF') ('Linux', '5.15.0-94-generic', '#104~20.04.1-Ubuntu SMP Tue Jan 16 13:34:09 UTC 2024') Python 3.11.5 Interface language: None EXE path: /opt/calibre/bin/calibre Successfully initialized third party plugins: DeACSM (0, 0, 16) Traceback (most recent call last): File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin File "calibre/customize/ui.py", line 513, in add_plugin File "calibre/customize/ui.py", line 64, in load_plugin File "calibre/customize/zipplugin.py", line 299, in load File "calibre/customize/zipplugin.py", line 394, in _locate_code calibre.customize.InvalidPlugin: The plugin in '/home/mel/Downloads/DeDRM_tools_10.0.3.zip' is invalid. It does not contain a top-level init.py file

Please advise.

ElleKayEm commented 8 months ago

Use DeDRM 10.0.9. Unzip DeDRM_tools_10.0.9.zip and load DeDRM_plugin.zip into calibre.

https://github.com/noDRM/DeDRM_tools/releases/tag/v10.0.9

sheepdoggie commented 8 months ago

Result with 10.0.9 when installing from the DeDRM_tools.zip: calibre, version 7.5.1 ERROR: Unhandled exception: InvalidPlugin:The plugin in '/home/mel/Downloads/DeDRM_tools_10.0.9.zip' is invalid. It does not contain a top-level init.py file

calibre 7.5.1 embedded-python: True Linux-5.15.0-94-generic-x86_64-with-glibc2.31 Linux ('64bit', 'ELF') ('Linux', '5.15.0-94-generic', '#104~20.04.1-Ubuntu SMP Tue Jan 16 13:34:09 UTC 2024') Python 3.11.5 Interface language: None EXE path: /opt/calibre/bin/calibre Successfully initialized third party plugins: DeACSM (0, 0, 16) Traceback (most recent call last): File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin File "calibre/customize/ui.py", line 513, in add_plugin File "calibre/customize/ui.py", line 64, in load_plugin File "calibre/customize/zipplugin.py", line 299, in load File "calibre/customize/zipplugin.py", line 394, in _locate_code calibre.customize.InvalidPlugin: The plugin in '/home/mel/Downloads/DeDRM_tools_10.0.9.zip' is invalid. It does not contain a top-level init.py file

But unziping and installing from the DeDRM_plugin.zip does not have the error. It does install. Thank you.

docborg98 commented 8 months ago

I am using calibre-64bit-7.7.0 and I have tried several version of the DeDRM zip. I always get "Invalidplugin C;\users.........DeDRM tools.....zip is invalid" It does not contain a top level _init_py file. I have spent hours on this and am so frustrated.

ElleKayEm commented 8 months ago

@docborg98 Download from the first link under Assets on this page: https://github.com/noDRM/DeDRM_tools/releases/tag/v10.0.9

Unzip only that main file. Make sure your browser isn't automatically unzipping anything on download. Load DeDRM_plugin.zip into calibre.

docborg98 commented 8 months ago

Thank you - I cut and pasted just the zip file for the plug in and that worked. When I clicked on the original zip file to get to the plugin, it wouldn't work!

ElleKayEm commented 8 months ago

Well, I guess that works too. I just unzip the main file and then retrieve the plugin zip file from the unzipped folder. Not from inside the original still zipped up file.

GommT95 commented 3 weeks ago

When in Calibre, attempting to install the plug-in, I cant even locate a plug-in file (I've tried literally everything you have suggested but for whatever reason my PC cannot locate it)

ElleKayEm commented 3 weeks ago

It's going to be whereever you download it to. I put it on my desktop as that's easy to navigate to.