Skip to content

Commit

Permalink
Poppler backend: search for pdftopng in current environment
Browse files Browse the repository at this point in the history
Fix situation where pdftopng is not found if executing python directly from an un-activated environment.
  • Loading branch information
orent authored and bosd committed Feb 28, 2024
1 parent 706ea1a commit 1b5a621
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion camelot/backends/poppler_backend.py
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit 1b5a621

Please sign in to comment.