From 3b60ee86740da09ec7f6b97adab25e3d1f1624f7 Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Sun, 11 Feb 2024 13:50:42 +0100 Subject: [PATCH] Strip trailing newlines from live text --- owocr/ocr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owocr/ocr.py b/owocr/ocr.py index fc69f95..243dff4 100644 --- a/owocr/ocr.py +++ b/owocr/ocr.py @@ -331,9 +331,9 @@ class AppleLiveText: process = Popen([self.helper_executable], stdout=PIPE, stdin=PIPE, stderr=PIPE) stdout, stderr = process.communicate(input=self._preprocess(img)) - stdout = stdout.decode() + stdout = stdout.decode().rstrip() if stdout == '': - return (False, stderr.decode()) + return (False, stderr.decode().rstrip()) return (True, stdout) def _preprocess(self, img):