From 5f4dfe5386217884e4dcd51ba8db8d0d20d1a487 Mon Sep 17 00:00:00 2001 From: Tomas Farago Date: Thu, 24 Oct 2013 15:46:13 +0200 Subject: [PATCH] Don't crash on uca camera readout --- concert/devices/cameras/uca.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/concert/devices/cameras/uca.py b/concert/devices/cameras/uca.py index 5ec92747f..751f7a39c 100644 --- a/concert/devices/cameras/uca.py +++ b/concert/devices/cameras/uca.py @@ -2,6 +2,7 @@ Cameras supported by the libuca library. """ import time +import logbook import numpy as np from concert.coroutines import null from concert.helpers import async, inject @@ -11,6 +12,9 @@ from concert.devices.cameras import base +LOG = logbook.Logger(__name__) + + def _new_setter_wrapper(camera, name, unit=None): def _wrapper(value): if unit: @@ -100,7 +104,12 @@ def readout(self, condition=lambda: True): as long as it resolves to True the camera keeps grabbing. """ while condition(): - image = self.grab() + image = None + try: + image = self.grab() + except Exception as exc: + LOG.debug("An error {} occured".format(exc) + + " during readout, stopping") if image is None: break yield image