PR Review Request: Fix silent failure when no OCR engine is available

Subject: PR Review Request: Fix silent failure when no OCR engine is available (#486)

Hi ,

I have submitted a Pull Request on GitHub (PR #486) to fix an issue where parse_document() silently returns empty output when no OCR engine is installed, and fails to raise the documented ValueError when force_ocr=True.

Summary of changes in the PR:

  • Guarded against the original use_ocr parameter instead of the overwritten document.use_ocr so warnings and ValueError work as expected.

  • Fixed the INFO_MESSAGES buffer cleanup by adding seek(0) before truncate().

  • Added 4 regression tests in tests/test_ocr_engine_missing.py.

Whenever you have a moment, I would really appreciate it if you could review the PR and let me know if you have any feedback or suggestions for improvement.

Thank you for your time and help!

@zguigo Welcome to the forum! Thanks for the PR. Realistically we will look at this next week as we are in the middle of a release so wevwon’t be considering new PRs until after the next release (hopefully coming very soon).

Just want to set your expectations here! :wink: