Leseratte10 / acsm-calibre-plugin

Calibre plugin for ACSM->EPUB and ACSM->PDF conversion.
https://www.mobileread.com/forums/showthread.php?t=341975
GNU General Public License v3.0
593 stars 23 forks source link

ModuleNotFoundError: No module named libadobe #92

Open banool opened 1 month ago

banool commented 1 month ago

Bug description

Same repro steps as in: https://github.com/Leseratte10/acsm-calibre-plugin/issues/72. Seems like https://github.com/Leseratte10/acsm-calibre-plugin/pull/88 perhaps didn't fix it for MacOS. I'm using the default sed.

I cloned the repo from master (commit 27bd9531c44f9896e4ade81c768c12e393e51e9a).

I get this error:

calibre, version 7.12.0
ERROR: Unhandled exception: <b>InvalidPlugin</b>:Initialization of plugin Traceback (most recent call last):
  File "calibre/customize/ui.py", line 722, in initialize_plugin
  File "calibre_plugins.deacsm.__init__", line 288, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
ModuleNotFoundError: No module named 'libadobe'
 failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 722, in initialize_plugin
  File "calibre_plugins.deacsm.__init__", line 288, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
ModuleNotFoundError: No module named 'libadobe'

calibre 7.12  embedded-python: True
macOS-14.5-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.5.0', 'Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000')
Python 3.11.5
OSX: ('14.5', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 722, in initialize_plugin
  File "calibre_plugins.deacsm.__init__", line 288, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
ModuleNotFoundError: No module named 'libadobe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre/gui2/preferences/plugins.py", line 322, in add_plugin
  File "calibre/customize/ui.py", line 532, in add_plugin
  File "calibre/customize/ui.py", line 727, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
  File "calibre/customize/ui.py", line 722, in initialize_plugin
  File "calibre_plugins.deacsm.__init__", line 288, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
ModuleNotFoundError: No module named 'libadobe'
 failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 722, in initialize_plugin
  File "calibre_plugins.deacsm.__init__", line 288, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
ModuleNotFoundError: No module named 'libadobe'

Operating system

MacOS

Which version of Calibre are you running?

7.12.0

Which version of the ACSM Input plugin are you running?

From commit 27bd9531c44f9896e4ade81c768c12e393e51e9a

Import type

No response

Further information

No response

banool commented 1 month ago

I get this output from running bundle_calibre_plugin.sh:

$ ./bundle_calibre_plugin.sh
~/github/acsm-calibre-plugin/calibre-plugin-tmp ~/github/acsm-calibre-plugin
~/github/acsm-calibre-plugin/calibre-plugin-tmp/keyextract ~/github/acsm-calibre-plugin/calibre-plugin-tmp ~/github/acsm-calibre-plugin
i686-w64-mingw32-gcc main.c -Os -o decrypt_win32.exe -lcrypt32 -lwsock32
make: i686-w64-mingw32-gcc: No such file or directory
make: *** [decrypt_win32.exe] Error 1
base64: invalid argument decrypt_win32.exe
Usage:  base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
  -b, --break    break encoded string into num character lines
  -Dd, --decode   decodes input
  -h, --help     display this message
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
base64: invalid argument decrypt_win64.exe
Usage:  base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
  -b, --break    break encoded string into num character lines
  -Dd, --decode   decodes input
  -h, --help     display this message
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
rm: decrypt_win32.exe: No such file or directory
rm: decrypt_win64.exe: No such file or directory
~/github/acsm-calibre-plugin/calibre-plugin-tmp ~/github/acsm-calibre-plugin
rm: __pycache__: No such file or directory
rm: *.pyc: No such file or directory
./bundle_calibre_plugin.sh: line 62: shopt: globstar: invalid shell option name
Injecting Python2 compat code ...
./bundle_calibre_plugin.sh: line 14: **/*.py.tmp: No such file or directory
mv: rename **/*.py.tmp to **/*.py: No such file or directory
updating: LICENSE (deflated 66%)
updating: README.md (deflated 60%)
updating: __calibre_compat_code.py (deflated 47%)
updating: __init__.py (deflated 71%)
updating: acsm_logo_2.png (deflated 2%)
updating: asn1crypto.zip (stored 0%)
updating: config.py (deflated 82%)
updating: cpuid.py (deflated 70%)
updating: customRSA.py (deflated 63%)
updating: exportPluginAuthToWindowsADE.py (deflated 67%)
updating: fulfill.py (deflated 66%)
updating: getEncryptionKeyLinux.py (deflated 63%)
updating: getEncryptionKeyWindows.py (deflated 68%)
updating: get_key_from_Adobe.py (deflated 60%)
updating: gui_main.py (deflated 65%)
updating: gui_main_wrapper.py (deflated 53%)
updating: keyextract/ (stored 0%)
updating: keyextract/Makefile (deflated 59%)
updating: keyextract/main.c (deflated 65%)
updating: keyextractDecryptor.py (deflated 49%)
updating: libadobe.py (deflated 68%)
updating: libadobeAccount.py (deflated 80%)
updating: libadobeFulfill.py (deflated 79%)
updating: libadobeImportAccount.py (deflated 72%)
updating: libpdf.py (deflated 71%)
updating: module_id.txt (stored 0%)
updating: oscrypto.zip (stored 0%)
updating: plugin-import-name-deacsm.txt (stored 0%)
updating: prefs.py (deflated 70%)
updating: register_ADE_account.py (deflated 61%)
updating: singleinstance_helper.py (deflated 62%)
~/github/acsm-calibre-plugin

Lots of errors, though I suspect some are expected since this is meant to be portable across multiple OSes.

banool commented 1 month ago

Okay installing DeDRM first made was what I needed to do to make this work. Unfortunately it doesn't work, if I import an acsm file it stays an acsm file, but that's separate to this issue.

For this issue it'd be nice if there was a more comprehensive README + better error messages.

Leseratte10 commented 1 month ago

Installing DeDRM is not needed for this plugin to function in general. I suspect a Calibre restart or computer restart might have solved this particular problem.

During the bundling, it fails to compile the keyextract code since you don't have the proper compiler installed, but that should't stop the plugin from functioning since it's only needed on Linux anyways, not on Windows or MacOS.

If the plugin fails to turn ACSM files into EPUBs, there's another error so you'll need to run Calibre in debug mode and check the logs again (or post them here).

I know the error handling for the plugin isn't always the greatest, most of the issues come from the fact that the plugin needs to load 3rd-party python plugins (which almost no other Calibre plugin does) and that doesn't always work properly.