pdfminer.six optional
This commit is contained in:
parent
a8f34b2e06
commit
b6bc9c8470
|
@ -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()
|
||||
|
|
4
setup.py
4
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,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue