Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/invoice2data/input/pdftotext.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def to_text(path: str, area_details: dict = None):
If pdftotext library is not found
"""
import subprocess
from distutils import spawn # py2 compat
import shutil

if spawn.find_executable("pdftotext"): # shutil.which('pdftotext'):
if shutil.which('pdftotext'):
cmd = ["pdftotext", "-layout", "-enc", "UTF-8"]
if area_details is not None:
# An area was specified
Expand Down
6 changes: 3 additions & 3 deletions src/invoice2data/input/tesseract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from distutils import spawn
import shutil
import tempfile
import mimetypes

Expand Down Expand Up @@ -29,9 +29,9 @@ def to_text(path):
"""

# Check for dependencies. Needs Tesseract and Imagemagick installed.
if not spawn.find_executable("tesseract"):
if not shutil.which("tesseract"):
raise EnvironmentError("tesseract not installed.")
if not spawn.find_executable("convert"):
if not shutil.which("convert"):
raise EnvironmentError("imagemagick not installed.")

language = get_languages()
Expand Down