pytango device server throws no exceptions

Hi there,

I am trying to set up a PyTango device server for a stage in our lab. Even though the setup of a simple device server and its testing with Jives 'Test Device' function works well, upon having any problems I do not receive any kind of error message helping me to solve them.

This can be demonstrated using the PowerSupply.py example found here.

when i insert something like:


    def get_current(self):
        err()
        return self.__current

with err() being a function that is not implemented at all or raises some other kind of exception, the test server runs fine, but tango seems to just catch the exception without any output. Trying to read the current attribute with Jive only gives:

Unforseen exception when trying to read attribute. It was even not a Tango DevFailed exception

which of course is not really helpful on identifying a problem.

I also tried using the @DebugIt() decorator to get a clue of this behavior but this doesn't make a difference.
The problem you describe seems to correspond to the issue #215.

It has been fixed already and will become available in the next release of pytango.

Note that it's a python3-only issue.
Hi,

I am no PyTango expert but I can advise you to have a look at the documentation about exceptions in PyTango:
https://pytango.readthedocs.io/en/latest/exception.html

As you may know, Tango device servers and clients can be written in different programming languages. These languages have different ways to deal with exceptions.
A special exception type has been defined in Tango to be able to transport generic Tango exceptions between clients and device servers. This type is named DevFailed.
All the Tango clients and device servers know about this type and know how to deal with it.

If you want your client to get some information about the exception which occurred in your get_current() method, this method could throw a DevFailed exception as described in the PyTango documentation (see link above).

PyTango experts might be able to give you more details about how they usually deal with the use cases you described (err() method not implemented for instance). My guess is that they surround this code in a try/catch and convert the received exception to a DevFailed exception and throw the DevFailed exception.

I hope this helps a bit.
Kind regards,
Reynald

Edit: Ooops, I was too slow! Thank you Vincent for the answer! smile
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Edited 3 weeks ago
Thanks a lot Vincent and Reynald. I think it now has now come clear to me how exceptions are supposed to work in Tango.

I tried the example in python 2.7 which solved the problem and shows me what caused the error in Jive. That'll be enough to work with until the next Tango update.
 
Register or login to create to post a reply.