Problem when writing spectrum attribute with empty list
I use PyTango 9.2.0 and tango 9.2.5 (default Debian 9 packages). I have a problem when I try to write an empty list to a spectrum attribute in a python device (sorry about the old API...).
In [21]: pydsexp = PyTango.DeviceProxy("test/pydsexp/1")
In [22]: pydsexp.write_attribute("attr1", [])
In [23]: pydsexp.read_attribute("attr1")
---------------------------------------------------------------------------
DevFailed Traceback (most recent call last)
<ipython-input-23-4a01a2a2ea48> in <module>()
----> 1 pydsexp.read_attribute("attr1")
/usr/lib/python2.7/dist-packages/tango/green.pyc in greener(self, *args, **kwargs)
264
265 # submit the method
--> 266 ret = submitter(fn, self, *args, **kwargs)
267
268 # return the proper result
/usr/lib/python2.7/dist-packages/tango/green.pyc in submit(self, fn, *args, **kwargs)
98 class SynchExecutor(object):
99 def submit(self, fn, *args, **kwargs):
--> 100 return fn(*args, **kwargs)
101
102 __synch_executor = SynchExecutor()
/usr/lib/python2.7/dist-packages/tango/device_proxy.pyc in __DeviceProxy__read_attribute(self, value, extract_as)
328
329 def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy):
--> 330 return __check_read_attribute(self._read_attribute(value, extract_as))
331
332 #def __DeviceProxy__read_attribute(self, value, extract_as=ExtractAs.Numpy,
/usr/lib/python2.7/dist-packages/tango/device_proxy.pyc in __check_read_attribute(dev_attr)
123 def __check_read_attribute(dev_attr):
124 if dev_attr.has_failed:
--> 125 raise DevFailed(*dev_attr.get_err_stack())
126 return dev_attr
127
DevFailed: DevFailed[
DevError[
desc = Data pointer for attribute attr1 is NULL!
origin = Attribute::set_value()
reason = API_AttrOptProp
severity = ERR]
DevError[
desc = Failed to read_attribute on device test/pydsexp/1, attribute attr1
origin = DeviceProxy::read_attribute()
reason = API_AttributeFailed
severity = ERR]
]
When I do the same test in the TangoTest attribute e.g. float_spectrum I don't see this problem:
In [24]: tangotest = PyTango.DeviceProxy("sys/tg_test/1")
In [25]: tangotest.write_attribute("float_spectrum", [])
In [26]: tangotest.read_attribute("float_spectrum")
Out[26]: DeviceAttribute(data_format = tango._tango.AttrDataFormat.SPECTRUM, dim_x = 0, dim_y = 0, has_failed = False, is_empty = True, name = 'float_spectrum', nb_read = 0, nb_written = 0, quality = tango._tango.AttrQuality.ATTR_VALID, r_dimension = AttributeDimension(dim_x = 0, dim_y = 0), time = TimeVal(tv_nsec = 0, tv_sec = 1504707208, tv_usec = 447424), type = tango._tango.CmdArgType(4294967295), value = None, w_dim_x = 0, w_dim_y = 0, w_dimension = AttributeDimension(dim_x = 0, dim_y = 0), w_value = None)
Any suggestion? Am I doing something wrong in the server or it may be a bug?