Skip to content

Commit

Permalink
replace distutils with shutil
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Feb 18, 2023
1 parent 09491f5 commit f393d9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit f393d9a

Please sign in to comment.