aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/epy.py b/epy.py
index 35008e7..9d355f8 100755
--- a/epy.py
+++ b/epy.py
@@ -39,7 +39,11 @@ from html.parser import HTMLParser
from difflib import SequenceMatcher as SM
from functools import wraps
-import mobi
+try:
+ import mobi
+ MOBISUPPORT = True
+except ModuleNotFoundError:
+ MOBISUPPORT = False
# -1 is default terminal fg/bg colors
@@ -927,10 +931,14 @@ def det_ebook_cls(file):
return Epub(file)
elif filext == ".fb2":
return FictionBook(file)
- elif filext == ".mobi":
+ elif MOBISUPPORT and filext == ".mobi":
return Mobi(file)
+ elif not MOBISUPPORT and filext == ".mobi":
+ sys.exit("""ERR: Format not supported. (Supported: epub, fb2).
+To get mobi support, install mobi module from pip.
+ $ pip install mobi""")
else:
- sys.exit("ERR: Format not supported. (Supported: epub, fb2, mobi)")
+ sys.exit("ERR: Format not supported. (Supported: epub, fb2)")
def dots_path(curr, tofi):