Flip catching modulenotfound to import error exception

This commit is contained in:
sabaimran 2023-11-04 19:34:10 -07:00
parent 8c3d5a49da
commit dbaa892665

View file

@ -70,7 +70,7 @@ class PdfToEntries(TextToEntries):
f.write(bytes) f.write(bytes)
try: try:
loader = PyMuPDFLoader(f"{tmp_file}", extract_images=True) loader = PyMuPDFLoader(f"{tmp_file}", extract_images=True)
except ModuleNotFoundError: except ImportError:
loader = PyMuPDFLoader(f"{tmp_file}") loader = PyMuPDFLoader(f"{tmp_file}")
pdf_entries_per_file = [page.page_content for page in loader.load()] pdf_entries_per_file = [page.page_content for page in loader.load()]
entry_to_location_map += zip(pdf_entries_per_file, [pdf_file] * len(pdf_entries_per_file)) entry_to_location_map += zip(pdf_entries_per_file, [pdf_file] * len(pdf_entries_per_file))