Skip to content

Commit

Permalink
Checkfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jakep-allenai committed Nov 1, 2024
1 parent 9f010e6 commit 5ebc8cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pdelfin/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
def check_poppler_version():
try:
result = subprocess.run(['pdftoppm', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0 and "pdftoppm" in result.stdout:
if result.returncode == 0 and result.stderr.startswith("pdftoppm"):
logger.info("pdftoppm is installed and working.")
else:
logger.error("pdftoppm is installed but returned an error.")
logger.error(f"pdftoppm is installed but returned an error.")
sys.exit(1)
except FileNotFoundError:
logger.error("pdftoppm is not installed.")
logger.error("Check the README in the https://github.com/allenai/pdelfin/blob/main/README.md for installation instructions")
sys.exit(1)
sys.exit(1)

if __name__ == "__main__":
check_poppler_version()

0 comments on commit 5ebc8cd

Please sign in to comment.