Problem with dynamic attributes using pytango 9.3.4 - read-parameter() missing 1 argument
|
|
---|---|
Hi, I am posting a problem we discovered with PyTango 9.3.4 with dynamic attributes. Dynamic attributes fail with this error: Description - TypeError: read_parameter() missing 1 required positional argument: 'attr' Here is an example of a client:
The same call with pytango from conda forge 9.3.3 is fine
The problem is on the server side. When a device server is started with pytango 9.3.4, it gives the attribute error. When started with 9.3.3, even a 9.3.4 client works fine. Any tips or explanations of what we are doing wrong are welcome! Andy + Antonia |
|
|
---|---|
Hello, The problem is related to the fix of PyTango: issue 401... The general solution is, that when you add dynamic attribute, for f_get, g_set and f_is_allowed you should use "f_set = self.my_read_method" statement. I guess you do something like "f_set = <My_Class_name>.my_read_method" - this won't work. Here there is a related discussion and explanation: PyTango: issue 454... |
|
|
---|---|
Hi Yury, thank you for this answer - it solves the problem! For anyone who encounters this problem the solution is as described by Yury above (with slightly different example names): replace with in the self.add_attribute() call e.g.
The same for the write method of course. If you do this then your device server will work with pytango 9.3.4 Q: is this compatible with previous versions of pytango? Q: why was the syntax with the <class name> used in the first place? The whole thing has something to do with bound and unbound variables in Python but don't ask me to explain it! Andy |
|
|
---|---|
Andy- yes, statements like
are compatible with previous pytango Andy - this I do not know. Actually, for me, usage of unbound methods to read|write attribute of the particular device is at least strange. |