Skip to content

Commit

Permalink
Checks for dependencies - tesseract and imagemagick
Browse files Browse the repository at this point in the history
  • Loading branch information
duskybomb authored and Manu committed May 21, 2018
1 parent a526a0d commit dbffe6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions invoice2data/input/tesseract.py
Expand Up @@ -14,6 +14,13 @@ def to_text(path):
"""
import subprocess
from distutils import spawn

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

convert = "convert -density 350 %s -depth 8 tiff:-" % (path)
p1 = subprocess.Popen(convert.split(' '), stdout=subprocess.PIPE)
Expand Down

0 comments on commit dbffe6d

Please sign in to comment.