diff --git a/photobooth/camera/CameraGphoto2.py b/photobooth/camera/CameraGphoto2.py index 60b2add..0661db0 100644 --- a/photobooth/camera/CameraGphoto2.py +++ b/photobooth/camera/CameraGphoto2.py @@ -136,15 +136,21 @@ class CameraGphoto2(CameraInterface): def setActive(self): - config = self._cap.get_config() - config.get_child_by_name('output').set_value('PC') - self._cap.set_config(config) + try: + config = self._cap.get_config() + config.get_child_by_name('output').set_value('PC') + self._cap.set_config(config) + except BaseException as e: + logging.warn('Error while setting camera output to active: {}.'.format(e)) def setIdle(self): - config = self._cap.get_config() - config.get_child_by_name('output').set_value('Off') - self._cap.set_config(config) + try: + config = self._cap.get_config() + config.get_child_by_name('output').set_value('Off') + self._cap.set_config(config) + except BaseException as e: + logging.warn('Error while setting camera output to idle: {}.'.format(e)) def getPreview(self): diff --git a/photobooth/camera/CameraGphoto2Cffi.py b/photobooth/camera/CameraGphoto2Cffi.py index 4b9cf03..c4a7b47 100644 --- a/photobooth/camera/CameraGphoto2Cffi.py +++ b/photobooth/camera/CameraGphoto2Cffi.py @@ -106,13 +106,19 @@ class CameraGphoto2Cffi(CameraInterface): def setActive(self): - self._cap._get_config()['actions']['viewfinder'].set(True) - self._cap._get_config()['settings']['output'].set('PC') + try: + self._cap._get_config()['actions']['viewfinder'].set(True) + self._cap._get_config()['settings']['output'].set('PC') + except BaseException as e: + logging.warn('Error while setting camera output to active: {}.'.format(e)) def setIdle(self): - self._cap._get_config()['actions']['viewfinder'].set(False) - self._cap._get_config()['settings']['output'].set('Off') + try: + self._cap._get_config()['actions']['viewfinder'].set(False) + self._cap._get_config()['settings']['output'].set('Off') + except BaseException as e: + logging.warn('Error while setting camera output to idle: {}.'.format(e)) def getPreview(self):