]> xmof Git - DeDRM.git/commitdiff
Catch FileNotFoundError due to undownloaded ebooks
authorprecondition <57645186+precondition@users.noreply.github.com>
Thu, 10 Aug 2023 09:09:49 +0000 (11:09 +0200)
committernoDRM <no_drm123@protonmail.com>
Sun, 10 Nov 2024 13:11:28 +0000 (13:11 +0000)
Obok_plugin/action.py

index e4ef377d53f6e1e0f91d840ec63954f9a357a332..af656ec1713eaa2b9ca050b42c825a8388e2a2c0 100644 (file)
@@ -374,7 +374,11 @@ class InterfacePluginAction(InterfaceAction):
         result['success'] = False
         result['fileobj'] = None
 
-        zin = zipfile.ZipFile(book.filename, 'r')
+        try:
+            zin = zipfile.ZipFile(book.filename, 'r')
+        except FileNotFoundError:
+            print(_("File not found. Make sure that the ebook has been properly downloaded in the Kobo app. ("), book.filename, _(")"))
+            return result
         #print ('Kobo library filename: {0}'.format(book.filename))
         for userkey in self.userkeys:
             print (_('Trying key: '), codecs.encode(userkey, 'hex'))