rdemaria / pytimber

Python Wrapping of CALS API
12 stars 23 forks source link

Fix missing value attribute #76

Closed loiccoyle closed 4 years ago

loiccoyle commented 4 years ago

Hi again, I'm now getting the following error:

print(db.getMetaData('LHC.BLMI:LOSS_RS09'))
  File "/afs/cern.ch/work/l/lcoyle/public/pylossmap/src/pytimber_master/pytimber/pytimber.py", line 909, in getMetaData
    vv = [[aa.value for aa in a.iterator()] for a in metadata.values()]
  File "/afs/cern.ch/work/l/lcoyle/public/pylossmap/src/pytimber_master/pytimber/pytimber.py", line 909, in <listcomp>
    vv = [[aa.value for aa in a.iterator()] for a in metadata.values()]
  File "/afs/cern.ch/work/l/lcoyle/public/pylossmap/src/pytimber_master/pytimber/pytimber.py", line 909, in <listcomp>
    vv = [[aa.value for aa in a.iterator()] for a in metadata.values()]
AttributeError: 'java.util.TreeMap.Entry' object has no attribute 'value'

It seems the API of java.util.TreeMap.Entry changed and value no longer exists ? Replacing value with getValue() seems to have fixed it.

I also added a simple test for the getMetaData method.

pep8speaks commented 4 years ago

Hello @loiccoyle! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 913:80: E501 line too long (84 > 79 characters)

rdemaria commented 4 years ago

it is not the API but jpype that no longer allows to access private members. Thanks for the fix!