From a8ea105b4c6dc37a917bba739a401f4648953cf1 Mon Sep 17 00:00:00 2001 From: Audiobook Producer Date: Sun, 18 Oct 2026 01:50:39 -0500 Subject: [PATCH] process: show the OCR failure reason in the error --- _pipeline/process.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_pipeline/process.py b/_pipeline/process.py index 98e34db..1e0f6d3 100644 --- a/_pipeline/process.py +++ b/_pipeline/process.py @@ -142,7 +142,8 @@ def check_ocr(cfg, book_dir): ocr_pdf = os.path.join(settings.resolve(cfg, "work_dir"), os.path.basename(book_dir), "ocr.pdf") pages = ",".join(map(str, missing)) if not os.path.exists(ocr_pdf): - msg = "pdf pages %s have no text layer and OCR did not produce a text copy (is ocrmypdf installed? see warnings.log)" % pages + why = " | ".join(ln for ln in read_if(os.path.join(book_dir, bookio.WARN_NAME)).splitlines() if ln.startswith("ingest |")) + msg = "pdf pages %s have no text layer and OCR did not produce a text copy. Reason logged: %s" % (pages, why or "none (is ocrmypdf installed?)") if cfg["ocr"].get("required", True): raise Failed("ingest: " + msg) print("WARNING:", msg)