Many attribute callbacks expect read_attibute(SPECTRUM) to return an array type; e.g. calling standard python methods like len(attr.value)
If the read attribute is empty, PyTango 8* is returning None instead; it is causing exceptions in the code. Thus, some attributes that are ok but just empty are not being properly displayed.
I see than the error can be bypassed using dim_x to check for array lenght. But, is this behavior the expected one or is this a bug?
good question.
Today in C++, the client would throw an exception API_EmptyDeviceAttribute.
In PyTango this exception is handled by setting:
.value = None
.is_empty = True
In Java (behavior from Jive) it seems it sets .value = []
We started discussing in the kernel team on how to handle it. We have to take into account backward compatibility so it needs some thinking.
We will keep you informed.
For (Py)Tango 8 I suggest that you code it this way:
Diff:
It seems backward compatibility is an issue in Tango so I am afraid I cannot change the behavior. It was not forseen in tango that None != [] != exception which is a shame