Closed fperrin closed 2 years ago
Interesting that you got an import error inside libadobe. That one should only use Python modules that come with Calibre. Which import error would that be? The PyCrypto one you tried to fix with #4?
If I remember correctly there was a reason why I used the deprecated PyCrypto instead of the new Cryptodome, but right now I don't remember what that was. I'll take a look again and test everything with that change and see if everything still works as intended.
The import error I got was indeed when trying to import Crypto
.
local variable 'update_account_path' referenced before assignment
can only happen if from calibre_plugins.deacsm.libadobe import ..., update_account_path
fails; and if that import fails, the software can't do anything useful, so, in my opinion, there is no point in catching the exception.
Beyond that, why are the imports not at the top of the file as is usual?
Forgot to answer that question - the imported files themselves (libadobe, libadobeAccount and libadobeFulfill) depend on some of the Python modules that are extracted from ZIP files (because they aren't included with Calibre) in the init function. If the imports were at the top of the file they would fail since the dependencies wouldn't be extracted yet.
Hi @Leseratte10 ,
I had the same errors as @Hellmark in issue #2 , that is,
local variable 'update_account_path' referenced before assignment
when trying to add the plugin. It turned out the problem was an import error inside libadobe. However, sinceimport libadobe
is inside a try/except block that prints something then throws away the exception, I was unable to see the actual error; even the "show details" button in Calibre would not print the error.This PR replaces the inner
try: import ... except: print(...)
pattern with a simpleimport
, so that the actual error is shown by calibre.Beyond that, why are the imports not at the top of the file as is usual?