diff --git a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py index 49ce86bfb663b87685ee23c205203f1bfce31f26..0c13cf057df55be2895376c87a75427efb55ce29 100644 --- a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py +++ b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py @@ -15,7 +15,7 @@ from abc import abstractmethod # PyTango imports from tango.server import Device, command, DeviceMeta, attribute -from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy +from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy, DevFailed import time import math @@ -284,13 +284,11 @@ class lofar_device(Device, metaclass=AbstractDeviceMetas): pollperiod: how often to check the attribute, in seconds. """ - attr = getattr(self.proxy, attr_name) - # Poll every half a second for _ in range(math.ceil(timeout/pollperiod)): - if attr != value: + if getattr(self.proxy, attr_name) != value: return time.sleep(pollperiod) - raise Exception(f"{attr} != {value} after f{timeout} seconds still.") + raise Exception(f"{attr_name} != {value} after {timeout} seconds still.")