DevFailed does not support indexing
|
|
---|---|
Hello. It seems that python3 version of PyTango 9.2.2 does not support indexing of DevFailed. I tried the following code on python 2 and python3.
Info: Ubuntu 18.04 PyTango 9.2.2 python 3.6 libboost-python1.65 |
|
|
---|---|
I am not a PyTango expert but it seems like the DevFailed type has changed and you now need to specify ex.args[0] e.g.
Maybe a Python expert can explain the new type. Andy |
|
|
---|---|
I mean that the same code works well on python 2 but fails on python 3.
Packages: python3-pytango: 9.2.2-1build1 python-pytango: 9.2.2-1build1 |
|
|
---|---|
Yes, BaseException.__getitem__ has been removed in python 3. Do you think it's a problem? |
|
|
---|---|
I missed that Exception API was changed. It is not a huge problem. In my opinion, there is no need to provide full compatibility with old code. Yes, Some problems could arise during porting python2 code to python3. I think that the optimal solution is to create "Porting guideline" page in Docs. |
|
|
---|---|
Hi, related to this issue, we did find a bug in pyutil.py in method __Util__create_device: try: db.import_device(device_name) except DevFailed as df: device_exists = not df[0].reason == "DB_DeviceNotDefined" it should be: try: db.import_device(device_name) except DevFailed as df: device_exists = not df.args[0].reason == "DB_DeviceNotDefined" Could we get a fix in the next release, please? Thanks for you help. Laurent
Laurent
|