unsubscribe_event exception
|
|
---|---|
Dear all, I'm working with PyTango 9.2.5 and I've noted that unsubscribe_event failure raises a KeyError exception and not an EventSystemFailed (as stated in the documentation). This may cause problems in exception handling. May be I'm doing something wrong. Thanks in advance for any help Elisabetta |
|
|
---|---|
Hi Elisabetta You haven't provided much info, so I'll take a guess. I see the docs do say it might throw EventSystemFailed, so we should probably add the KeyError as well. If you're not just asking about the documentation, but want to know why you are getting the KeyError, one of the causes, would be if you are using different instances of the DeviceProxy. For example, if you subscribe for with instance A, and unsubscribe with instance B, that will fail. You must use the same instance to subscribe and unsubscribe. This type of error would look something like this (dp2 is a tango.DeviceProxy object):
There would be a similar error if the ID used to unsubscribe was invalid. If that is not the type of error you are seeing, please post more details. |
|
|
---|---|
Hi Anton, thanks for the reply. I'm trying to enforce my code adding more accurate exception handling. To test a part of the code I've tried to unsubscribe an invalid event, but no tango.DevFailed exception was raised but only KeyError. I didn't understand why, I checked the documentation and ask to the forum to get confirm of this. And I got it! Thanks Elisabetta |
|
|
---|---|
Glad to help. Thanks for pointing out the issue. I have made a PR on pytango to update the docs. https://github.com/tango-controls/pytango/pull/293 |