Skip to content

Commit

Permalink
Make dependency checks less... crashy
Browse files Browse the repository at this point in the history
  • Loading branch information
BasioMeusPuga committed Mar 3, 2019
1 parent d6df28c commit c8fe0ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lector/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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,
Expand All @@ -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)

Expand Down

0 comments on commit c8fe0ba

Please sign in to comment.