From 416830cbe861689f7fcb2baf5aa5901352313201 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Fri, 10 Oct 2025 12:27:09 +0100 Subject: [PATCH] Strip new lines when logging stitching --- src/openflexure_microscope_server/stitching.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index 09d72753..ba0f4b6f 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -300,7 +300,7 @@ class FinalStitcher(BaseStitcher): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, - universal_newlines=True, + text=True, ) # Stop opening pipe blocking writing to it os.set_blocking(process.stdout.fileno(), False) @@ -344,5 +344,7 @@ class FinalStitcher(BaseStitcher): def log_buffer(self, buffer: TextIOWrapper) -> None: """Log everything in the buffer at INFO level.""" + # Use rstrip to remove newlines from each line, as logging provides its own + # new lines while line := buffer.readline(): - self.logger.info(line) + self.logger.info(line.rstrip())