diff --git a/mkv_this/functions.py b/mkv_this/functions.py index c037c0e..853485f 100644 --- a/mkv_this/functions.py +++ b/mkv_this/functions.py @@ -5,11 +5,6 @@ import markovify import sys import html2text -from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter -from pdfminer.converter import TextConverter -from pdfminer.layout import LAParams -from pdfminer.pdfpage import PDFPage -from io import StringIO fnf = ": error: file not found. please provide a path to a really-existing file!" @@ -144,6 +139,17 @@ def dir_cat(matchlist, bulkfile): # extract full text from a pdf: def convert_pdf(path): + try: + from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter + from pdfminer.converter import TextConverter + from pdfminer.layout import LAParams + from pdfminer.pdfpage import PDFPage + from io import StringIO + except ModuleNotFoundError as exc: + print( + f": there was trouble: {exc}.\n: install 'pdfminer.six' with pip to convert a pdf." + ) + sys.exit() print(": converting pdf file...") try: rsrcmgr = PDFResourceManager() diff --git a/setup.py b/setup.py index fe1ec75..613a971 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: setup( name="mkv-this", - version="0.2.4", + version="0.2.5", description="cli wrapper for markovify: take a text file, directory, pdf or url, markovify, save the results.", long_description=long_description, long_description_content_type="text/markdown", @@ -24,6 +24,6 @@ setup( "mkv-this-dir = mkv_this.mkv_this_dir:main", ] }, - install_requires=["markovify", "argparse", "html2text", "requests", "pdfminer.six",], + install_requires=["markovify", "argparse", "html2text", "requests",], zip_safe=False, )