Adjust PDF conversion subprocess for Python v3.6 (#194)

This commit is contained in:
Tanay Soni 2020-07-06 16:56:10 +02:00 committed by GitHub
parent 7ada5a91cd
commit 0eb8a29da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,7 @@ class PDFToTextConverter(BaseConverter):
command = ["pdftotext", "-layout", str(file_path), "-"]
else:
command = ["pdftotext", str(file_path), "-"]
output = subprocess.run(command, capture_output=True, shell=False)
output = subprocess.run(command, stdout=subprocess.PIPE, shell=False)
document = output.stdout.decode(errors="ignore")
pages = document.split("\f")
pages = pages[:-1] # the last page in the split is always empty.