From 736a09ff5fdd08e8046af985059763cd36923496 Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Thu, 12 Nov 2020 19:03:20 +0100 Subject: [PATCH] imager: catch BrokenPipeError --- scripts/planktoscope/imager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/planktoscope/imager.py b/scripts/planktoscope/imager.py index 7243eab..0037450 100644 --- a/scripts/planktoscope/imager.py +++ b/scripts/planktoscope/imager.py @@ -99,14 +99,13 @@ class StreamingHandler(http.server.BaseHTTPRequestHandler): output.condition.wait() frame = output.frame self.wfile.write(b"--FRAME\r\n") - # TODO exception BrokenPipeError here self.send_header("Content-Type", "image/jpeg") self.send_header("Content-Length", len(frame)) self.end_headers() self.wfile.write(frame) self.wfile.write(b"\r\n") - except Exception as e: - logger.exception(f"Removed streaming client {self.client_address}") + except BrokenPipeError as e: + logger.info(f"Removed streaming client {self.client_address}") else: self.send_error(404) self.end_headers()