Fix TypeError "environment can only contain strings"

Apparently Windows Python doesn't coerce pathlib.Path to str.
This commit is contained in:
James R. Barlow
2019-12-04 17:13:51 -08:00
parent e63503d64b
commit 3f92867ae6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ def create_options(*, input_file, output_file, **kwargs):
# If we are running a Tesseract spoof, ensure it knows what the input file is
if os.environ.get('PYTEST_CURRENT_TEST') and options.tesseract_env:
options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = input_file
options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file)
return options
+1 -1
View File
@@ -183,7 +183,7 @@ def check_ocrmypdf(input_file, output_file, *args, env=None):
api.check_options(options)
if env:
options.tesseract_env = env
options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = input_file
options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file)
result = api.run_pipeline(options, api=True)
assert result == 0