From ed407d4f9e9bfb19cf04e352cb0d6a20ef49688c Mon Sep 17 00:00:00 2001 From: boltgolt Date: Wed, 30 Dec 2020 15:20:10 +0100 Subject: [PATCH] Cleaned up AttributeError on wrong device path --- src/recorders/video_capture.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/recorders/video_capture.py b/src/recorders/video_capture.py index 6cf03d5..9d23d27 100644 --- a/src/recorders/video_capture.py +++ b/src/recorders/video_capture.py @@ -32,7 +32,10 @@ class VideoCapture: # Check device path if not os.path.exists(self.config.get("video", "device_path")): - print("Camera path is not configured correctly, please edit the 'device_path' config value.") + if self.config.getboolean("video", "warn_no_device"): + print("Howdy could not find a camera device at the path specified in the config file.") + print("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:") + print("\n\tsudo howdy config\n") sys.exit(1) # Create reader @@ -52,7 +55,10 @@ class VideoCapture: Frees resources when destroyed """ if self is not None: - self.internal.release() + try: + self.internal.release() + except AttributeError as err: + pass def release(self): """