Skip to content

Commit

Permalink
Handle the case if there are no cameras via except
Browse files Browse the repository at this point in the history
Otherwise, when trying to read the /dev/v4l/by-path directory, an
exception is thrown and the program visually freezes.
  • Loading branch information
Gliese852 committed Dec 5, 2023
1 parent 13c65e0 commit 74de854
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions howdy-gtk/src/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def is_gray(frame):
except Exception:
self.show_error(_("Error while importing OpenCV2"), _("Try reinstalling cv2"))

device_ids = os.listdir("/dev/v4l/by-path")
device_rows = []

if not device_ids:
try:
device_ids = os.listdir("/dev/v4l/by-path")
except Exception:
self.show_error(_("No webcams found on system"), _("Please configure your camera yourself if you are sure a compatible camera is connected"))

# Loop though all devices
Expand Down

0 comments on commit 74de854

Please sign in to comment.