Skip to content

Commit 19af6f4

Browse files
authored
bug: fix pdftotext installation verification (#3233)
1 parent 859c303 commit 19af6f4

File tree

1 file changed

+3
-3
lines changed
  • haystack/nodes/file_converter

1 file changed

+3
-3
lines changed

haystack/nodes/file_converter/pdf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def __init__(
5454
super().__init__(
5555
remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys
5656
)
57-
58-
verify_installation = subprocess.run(["pdftotext -v"], shell=True)
59-
if verify_installation.returncode == 127:
57+
try:
58+
subprocess.run(["pdftotext", "-v"], shell=False, check=False)
59+
except FileNotFoundError:
6060
raise FileNotFoundError(
6161
"""pdftotext is not installed. It is part of xpdf or poppler-utils software suite.
6262

0 commit comments

Comments
 (0)