From 4a0c9be576afd276647d15c91b27ba8e8091ce66 Mon Sep 17 00:00:00 2001 From: Nikos Livathinos Date: Thu, 10 Oct 2024 17:19:44 +0200 Subject: [PATCH] fix(TesseractOcrCliModel): Send the stderr to devnull to avoid poluting the console with messages from tesseract cmd Signed-off-by: Nikos Livathinos --- docling/models/tesseract_ocr_cli_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docling/models/tesseract_ocr_cli_model.py b/docling/models/tesseract_ocr_cli_model.py index c3c19991..052d878e 100644 --- a/docling/models/tesseract_ocr_cli_model.py +++ b/docling/models/tesseract_ocr_cli_model.py @@ -1,7 +1,7 @@ import io import logging import tempfile -from subprocess import PIPE, Popen +from subprocess import DEVNULL, PIPE, Popen from typing import Iterable, Tuple import pandas as pd @@ -81,7 +81,7 @@ class TesseractOcrCliModel(BaseOcrModel): cmd += [ifilename, "stdout", "tsv"] _log.info("command: {}".format(" ".join(cmd))) - proc = Popen(cmd, stdout=PIPE) + proc = Popen(cmd, stdout=PIPE, stderr=DEVNULL) output, _ = proc.communicate() # _log.info(output)