diff --git a/pdfkit/configuration.py b/pdfkit/configuration.py index 11785e1..06837d5 100644 --- a/pdfkit/configuration.py +++ b/pdfkit/configuration.py @@ -25,6 +25,15 @@ def __init__(self, wkhtmltopdf='', meta_tag_prefix='pdfkit-', environ=''): self.wkhtmltopdf = subprocess.Popen( ['where.exe', 'wkhtmltopdf'], stdout=subprocess.PIPE, startupinfo=startupinfo).communicate()[0] else: + try: + subprocess.Popen( + ['which'], stdout=subprocess.PIPE).communicate()[0] + except (IOError, FileNotFoundError) as e: + raise IOError('No which executable found. ' + 'If this file exists please check that this process can ' + 'read it or you can pass path to it manually in method call, ' + 'check README. Otherwise please install which - ' + 'https://github.com/JazzCore/python-pdfkit/wiki/Installing-which') self.wkhtmltopdf = subprocess.Popen( ['which', 'wkhtmltopdf'], stdout=subprocess.PIPE).communicate()[0]