Mandatory properties in classes generated by pogo (9.4)
Closed this issue · 4 comments
Hello,
I am not sure if the problem is with pogo or with pytango.
What I observe is that since the update from pytango8/pogo8 to pytango9/pogo9,
the files generated by pogo with mandatory properties gives the following error
when one tries to start the Tango Server:
File "TestMandPropDeb9.py", line 152
mandatory=True,
^
SyntaxError: invalid syntax
I think the mandatory feature for the properties was not implemented in pytango8
and pogo8 also ignore it, so there was not problem. In pytango9 (since 9.2.2) the
mandatory feature is implemented and it works if I try the class given by pytango in
the examples directory, where the properties are defined in the following way:
Hostname = device_property(
dtype='str', mandatory=True,
doc='The controller host address')
However pogo9 (9.4) defines the properties with other syntax:
device_property_list = {
'Hostaname':
[PyTango.DevString,
"The controller host address",
mandatory=True,
[] ],
mandatory=True,
}
And both lines 'mandatory=True' produce a syntax error trying to run the Tango Server.
So the mandatory feature can not be used for python tango servers generated by pogo.
Perhaps I am making something wrong or this is something known, but I could not find
anything about it.
Many thanks in advance.
Regards,
Teresa
@teresanunez I think this is a Pogo issue. The output you show from Pogo9 is invalid Python syntax, so looks like a problem in the Pogo template, around here: https://github.com/tango-controls/pogo/blob/b7b7e46/fr.esrf.tango.generator.xtend/src/fr/esrf/tango/pogo/generator/python/PythonUtils.xtend#L406-L408
You could try the "PythonHL" (i.e. high level) generation option from Pogo, rather than than old "Python" generation? That might work. I also recall the old "Python" option's generated code was still using the Device_4Impl (TANGO v7?) base class, while "PythonHL" uses the latest (currently Device_5Impl).
Hi @ajoubertza, many thanks for your answer. I have just tried it using PythonHL and it works.
So if the bug in pogo doesn't want to be solved (I don't know if using the option Python in pogo
instead of PythonHL is already considered as obsolete) the ticket could be close. Many thanks again.
Great! On fixing the bug or not, and continued "Python" generation support, maybe @Pascal-Verdier can comment?
Maybe @NexeyaSGara can also answer to the question about python generation support?