Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dev = cfg.get('Device')
if dev:
for k, v in dev.get('PylonParameters', {}).items():
try:
setattr(self._cam, k, v)
self.debug('Set {} to {}'.format(k, v))
except ValueError as e:
self.warning('Invalid Property value. k="{}",v={}. e={}'.format(k, v, e))
except KeyError:
self.warning('Invalid Camera Property "{}"'.format(k))
except RuntimeError as e:
self.warning('RunTimeError: {}. k={},v={}'.format(e, k, v))
except IOError as e:
self.warning('IOError: {}, k={}, v={}'.format(e, k, v))
except genicam.AccessException as e:
self.warning('Access Exception {}'.format(e))
self.pixel_depth = self._cam.PixelDynamicRangeMax.Value
self._cam.StartGrabbing(pylon.GrabStrategy_LatestImageOnly)