Menu

#626 attribute_history extraction can raised an exception

closed-works-for-me
PyTango
5
2013-11-22
2013-09-05
No

With PyTango 8.0.3 (compare to a PyTango 7.X.X) the following code raised an exception

dev = DeviceProxy("archiving/hdbextractor/1")
listAtt = []
listAtt.append("ANS/CA/MACHINESTATUS/current")
listAtt.append("1")
listAtt.append("04-09-2013 09:00:00")
listAtt.append("04-09-2013 10:00:00")

attrData = dev.command_inout("GetAttDataSupThanBetweenDates",listAtt)
for dev_hist in dev.attribute_history(attrData[1][0],attrData[0][0]):
print dev_hist.value

Where attrData is a DevVarLongStringArray sending by a Java device in Tango7.
attrData[1][0] is a Dynamic attribute name and attrData[0][0] is the number of elements in the list.

The exception is :
DeviceProxy.attribute_history(DeviceProxy, str, numpy.int32)
did not match C++ signature:
attribute_history(Tango::DeviceProxy {lvalue} self, std::string attr_name, int depth, PyTango::ExtractAs extract_as=PyTango._PyTango.ExtractAs.Numpy)

To solve it we need to cast the attrData[0][0] as follow:
for dev_hist in dev.attribute_history(attrData[1][0],int(attrData[0][0])):

Why the cast is no more done automatically?

Discussion

  • BUTEAU

    BUTEAU - 2013-10-24
    • assigned_to: Coutinho
     
  • BUTEAU

    BUTEAU - 2013-10-24

    Tiago
    I think your are the one in charge of PyTango package
    So I assign the issue to you

     
  • Tiago Coutinho

    Tiago Coutinho - 2013-11-20

    I've tested with:
    - Tango 7.2.6 & PyTango 7.2.3
    - Tango 8.0.5 & PyTango 8.0.3
    - Tango 8.1.2 & PyTango 8.1.1 (my private build)

    with code:

    d = PyTango.DeviceProxy("sys/tg_test/1")
    d.attribute_history("long_scalar", numpy.int32(10))

    ...and I cannot reproduce your problem.

    Maybe you are using PyTango without numpy support.
    Can you do the following test:

    $ python -c "import PyTango; print PyTango.constants.NUMPY_SUPPORT"

    If the answer is False it means that PyTango was built without numpy support and it should be the cause of the problem. In this case, if you compiled PyTango yourself I can help you find out why PyTango was not compiled with numpy support.

     
  • PIERRE-JOSEPH ZEPHIR

    Hi Tiago,

    I tried your command $ python -c "import PyTango; print PyTango.constants.NUMPY_SUPPORT" and the answer is TRUE.

    As the problem solved by a int cast usage, you can close this tickets.

    Anyway, thank you having searching for an explanation.

    Regards
    Sandra

     
  • Tiago Coutinho

    Tiago Coutinho - 2013-11-22
    • status: open --> closed-works-for-me
     
  • Tiago Coutinho

    Tiago Coutinho - 2013-11-22

    Ok, I will close the bug. It is strange, though!

    I will distribute a 8.1.1 soon. If you have time to test with 8.1.1 and the problem persists, please reopen the bug.

    Thanks in advance.

     

Log in to post a comment.