From 0f0157d71e20909863c7a486ca3b4e44920ec9f9 Mon Sep 17 00:00:00 2001 From: Mathieu De Coster Date: Thu, 22 Feb 2024 15:04:04 +0100 Subject: [PATCH] Raise EOFError at the end of a video stream --- .../cameras/opencv_videocapture/opencv_videocapture.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airo-camera-toolkit/airo_camera_toolkit/cameras/opencv_videocapture/opencv_videocapture.py b/airo-camera-toolkit/airo_camera_toolkit/cameras/opencv_videocapture/opencv_videocapture.py index 7d30840..af09b3e 100644 --- a/airo-camera-toolkit/airo_camera_toolkit/cameras/opencv_videocapture/opencv_videocapture.py +++ b/airo-camera-toolkit/airo_camera_toolkit/cameras/opencv_videocapture/opencv_videocapture.py @@ -79,8 +79,8 @@ def intrinsics_matrix(self) -> CameraIntrinsicsMatrixType: def _grab_images(self) -> None: ret, image = self.video_capture.read() - if not ret: - raise RuntimeError("Can't receive frame (stream end?). Exiting...") + if not ret: # When streaming a video, we will at some point reach the end. + raise EOFError("Can't receive frame (stream end?). Exiting...") self._frame = image