Skip to content

Commit 7ebe859

Browse files
NickHallPhysicscarandraug
authored andcommitted
ximea: ignore Timeout exceptions.
1 parent d5a6653 commit 7ebe859

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

microscope/cameras/ximea.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ def _fetch_data(self):
7272
self._triggered = False
7373
return self.img.get_image_data_numpy()
7474
except Exception as err:
75-
self._logger.info('Get image error %s' % err)
76-
raise
75+
if getattr(err, 'status', None) == 10:
76+
# This is a Timeout error
77+
return None
78+
else:
79+
raise err
7780
elif trigger_type == 'XI_TRG_EDGE_RISING':
7881
if self._acquiring:
7982
try:
@@ -83,10 +86,11 @@ def _fetch_data(self):
8386
self._logger.info('Sending image')
8487
return self.img.get_image_data_numpy()
8588
except Exception as err:
86-
if err.args is xiapi.Xi_error(10).args:
89+
if getattr(err, 'status', None) == 10:
90+
#This is a Timeout error
8791
return None
8892
else:
89-
self._logger.info('Get image error %s' % err)
93+
raise err
9094

9195
def abort(self):
9296
self._logger.info('Disabling acquisition.')
@@ -130,9 +134,12 @@ def get_current_image(self):
130134
self._logger.info('Sending image')
131135
self._triggered = False
132136
return data
133-
except Exception as e:
134-
self._logger.info("Error in ximeaCam: %s" % (e))
135-
raise Exception(str(xiapi.Xi_error(e.status)))
137+
except Exception as err:
138+
if getattr(err, 'status', None) == 10:
139+
# This is a Timeout error
140+
return None
141+
else:
142+
raise err
136143

137144
def make_safe(self):
138145
if self._acquiring:

0 commit comments

Comments
 (0)