From c8fe0ba8b66e192f289b122e94a6026a3bf79763 Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Sun, 3 Mar 2019 07:56:05 -0500 Subject: [PATCH] Make dependency checks less... crashy --- lector/sorter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lector/sorter.py b/lector/sorter.py index 625372f..73838e3 100644 --- a/lector/sorter.py +++ b/lector/sorter.py @@ -43,10 +43,6 @@ from PyQt5 import QtCore, QtGui from lector import database - -from lector.parsers.epub import ParseEPUB -from lector.parsers.mobi import ParseMOBI -from lector.parsers.fb2 import ParseFB2 from lector.parsers.comicbooks import ParseCOMIC logger = logging.getLogger(__name__) @@ -69,7 +65,11 @@ # python-lxml - Required for everything except comics lxml_check = importlib.util.find_spec('lxml') xmltodict_check = importlib.util.find_spec('xmltodict') -if lxml_check: +if lxml_check and xmltodict_check: + from lector.parsers.epub import ParseEPUB + from lector.parsers.mobi import ParseMOBI + from lector.parsers.fb2 import ParseFB2 + lxml_dependent = { 'epub': ParseEPUB, 'mobi': ParseMOBI, @@ -81,7 +81,7 @@ 'fb2.zip': ParseFB2} sorter.update(lxml_dependent) else: - critical_sting = 'python-lxml / xmltodict is not installed. Only comics will load.' + critical_sting = 'lxml / xmltodict is not installed. Only comics will load.' print(critical_sting) logger.critical(critical_sting)