From eebb425102bc3978c37c8c8595277d7eae2ea78c Mon Sep 17 00:00:00 2001 From: Caojunwei <97785943+dvdcjw@users.noreply.github.com> Date: Fri, 19 Jul 2024 07:48:00 +0800 Subject: [PATCH] Update dxcam.py --- dxcam/dxcam.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dxcam/dxcam.py b/dxcam/dxcam.py index b83f5f8..afc54e5 100644 --- a/dxcam/dxcam.py +++ b/dxcam/dxcam.py @@ -147,6 +147,9 @@ def stop(self): self.__stop_capture.clear() def get_latest_frame(self): + if not self.is_capturing: + raise capture_error( + 'camera is not started. camera.get_latest_frame unavailable.\nDid you forgot to run camera.start?') self.__frame_available.wait() with self.__lock: ret = self.__frame_buffer[(self.__head - 1) % self.max_buffer_len]