- if PikePDF module is not available then show an error but run the app (currently, for Python 3.11 is the only module not available)
This commit is contained in:
@@ -7,9 +7,15 @@
|
||||
|
||||
from appTool import *
|
||||
from appParsers.ParsePDF import PdfParser
|
||||
from pikepdf import Pdf, parse_content_stream
|
||||
|
||||
from camlib import grace
|
||||
|
||||
HAS_PIKE_MODULE = True
|
||||
try:
|
||||
from pikepdf import Pdf, parse_content_stream
|
||||
except ModuleNotFoundError:
|
||||
HAS_PIKE_MODULE = False
|
||||
|
||||
fcTranslate.apply_language('strings')
|
||||
if '_' not in builtins.__dict__:
|
||||
_ = gettext.gettext
|
||||
@@ -96,6 +102,11 @@ class ToolPDF(AppTool):
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("File no longer available."))
|
||||
return
|
||||
|
||||
if HAS_PIKE_MODULE is False:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
|
||||
self.app.log.error("PikePDF module is not available.")
|
||||
return
|
||||
|
||||
short_name = filename.split('/')[-1].split('\\')[-1]
|
||||
self.parsing_promises.append(short_name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user