Dear PyTango experts and users,
I’m still a newbee in PyTango, so sorry if I missed something obvious. ![]()
I was trying to execute an old piece of code I found in some old training slides and I was trying to update the code to make it work with latest pytango and with python3.
I have been using latest itango conda package to try out the code.
I encountered a problem when trying to use the tango.Except.print_error_stack method with the errors received from an EventData object as parameter.
Here is the code:
import tango
import time
dev = DeviceProxy("sys/tg_test/1")
eve_id=dev.subscribe_event("double_scalar",tango.EventType.CHANGE_EVENT,1)
i=0
while (i < 60):
i=i+1
if not dev.is_event_queue_empty(eve_id):
event_list=dev.get_events(eve_id)
event_data=event_list[0]
print("Event from device",event_data.device.dev_name())
print("for attribute",event_data.attr_name)
if event_data.err:
print("Error sent with event:")
tango.Except.print_error_stack(event_data.errors)
else:
if event_data.attr_value.quality == tango.AttrQuality.ATTR_INVALID:
print ("Attribute data is invalid")
else:
print("Attribute value =", event_data.attr_value.value)
time.sleep(1)
If I stop the TangoTest device server to generate an error event, here is what is displayed:
Event from device sys/tg_test/1
for attribute tango://mytangohost.esrf.fr:10000/sys/tg_test/1/double_scalar
Error sent with event:
ArgumentError: Python argument types in
Except.print_error_stack(tuple)
did not match C++ signature:
print_error_stack(Tango::DevErrorList)
(For more detailed information type: python_error)
It looks like tango.DevErrorList type does not exist in pytango so we cannot really use tango.Except.print_error_stack method.
Is there any alternative method to display nicely the errors received in an event?