diff --git a/actfw_core/v4l2/video.py b/actfw_core/v4l2/video.py index 14ae90c..4edeaf6 100644 --- a/actfw_core/v4l2/video.py +++ b/actfw_core/v4l2/video.py @@ -10,6 +10,7 @@ import os import select import time +import warnings from ctypes import * from ctypes.util import find_library from typing import List @@ -839,7 +840,11 @@ def __init__(self, device="/dev/video0", blocking=False): except OSError as e: # retry 3 times when device is busy if e.errno != errno.EBUSY or i == 2: - raise RuntimeError("open {}: {}".format(self.device, errno.errorcode[e.errno])) + raise RuntimeError(f"open {self.device}: {errno.errorcode[e.errno]}") + warnings.warn( + f"Retrying to open {self.device} after 1 second.", + RuntimeWarning, + ) time.sleep(1) self.converter = _v4lconvert.create(self.device_fd)