From 1b5a6216877ca64392fec743c0ac2b2bb723be9e Mon Sep 17 00:00:00 2001 From: orent Date: Mon, 26 Feb 2024 10:11:04 +0200 Subject: [PATCH] Poppler backend: search for pdftopng in current environment Fix situation where pdftopng is not found if executing python directly from an un-activated environment. --- camelot/backends/poppler_backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/camelot/backends/poppler_backend.py b/camelot/backends/poppler_backend.py index 90d37a97..ac41d831 100644 --- a/camelot/backends/poppler_backend.py +++ b/camelot/backends/poppler_backend.py @@ -1,10 +1,13 @@ +import os +import sys import shutil import subprocess +path = os.path.dirname(sys.executable) + os.pathsep + os.environ['PATH'] class PopplerBackend: def convert(self, pdf_path, png_path): - pdftopng_executable = shutil.which("pdftopng") + pdftopng_executable = shutil.which("pdftopng", path=path) if pdftopng_executable is None: raise OSError( "pdftopng is not installed. You can install it using the 'pip install pdftopng' command."