Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirecting stdout to stderr when loading EasyOCR-Reader to be compliant with ocrmypdf #13

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

rakurtz
Copy link
Contributor

@rakurtz rakurtz commented Aug 30, 2024

ocrmypdf allows to be called with - - to read from stdin and write to stdout.

when the easyocr model is loaded (also from cache into RAM) it produces output to stdout. this output will then be mixed into you .pdf data stream (at least at the begging).

this is quick fix using contexlib to redirect the output of easyocr loading to stderr.

redirecting stdout to stderr to be compliant with ocrmypdf. otherwise we brake the usage of ocrmypdf with piped stdin / stdout...
@jbarlow83 jbarlow83 merged commit 2ae0ae0 into ocrmypdf:main Aug 30, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants