Skip to content

Commit ee59b3d

Browse files
committed
DeviceServer: filter out device server args before init device (issue #84)
The device definition includes arguments for both the device server and the actual device constructor. Filter out those arguments meant only for the server when constructing the device.
1 parent e3488cb commit ee59b3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

microscope/deviceserver.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,14 @@ def run(self):
141141
logger.addHandler(stderr_handler)
142142
logger.addFilter(Filter())
143143
logger.debug("Debugging messages on.")
144-
self._device = self._device_def['cls'](index=self.count,
145-
**self._device_def)
144+
145+
## The device definition includes stuff that were never
146+
## meant for the device. Remove those.
147+
init_kwargs = self._device_def.copy()
148+
for def_key in ['cls', 'host', 'port', 'uid']:
149+
init_kwargs.pop(def_key)
150+
151+
self._device = self._device_def['cls'](index=self.count, **init_kwargs)
146152
while not self.exit_event.is_set():
147153
try:
148154
self._device.initialize()

0 commit comments

Comments
 (0)