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)