From 015fe37d001a2cfb4d93fef5ed2b729a181d201f Mon Sep 17 00:00:00 2001 From: Ali Hamdi Ali Fadel Date: Wed, 24 Jul 2024 12:29:14 +0000 Subject: [PATCH] Catch exceptions while processing files --- tahweel/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tahweel/cli.py b/tahweel/cli.py index 4c44942..fd8dea0 100644 --- a/tahweel/cli.py +++ b/tahweel/cli.py @@ -45,7 +45,11 @@ def main() -> None: for pdf_file_path in tqdm(pdf_file_paths, desc='Files'): pdf_file_manager = PdfFileManager(pdf_file_path, args.pdf2image_thread_count) - process_file(args, processor, pdf_file_manager) + try: + process_file(args, processor, pdf_file_manager) + except Exception: + print(f'Failed to process "{pdf_file_manager.file_path}", continuing...') + continue def prepare_package_dirs() -> None: