From: precondition <57645186+precondition@users.noreply.github.com> Date: Thu, 10 Aug 2023 09:09:49 +0000 (+0200) Subject: Catch FileNotFoundError due to undownloaded ebooks X-Git-Url: http://git.xmof.duckdns.org/?a=commitdiff_plain;h=2e53d70e88bc479c5b83a71301f580857dba60da;p=DeDRM.git Catch FileNotFoundError due to undownloaded ebooks --- diff --git a/Obok_plugin/action.py b/Obok_plugin/action.py index e4ef377..af656ec 100644 --- a/Obok_plugin/action.py +++ b/Obok_plugin/action.py @@ -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'))