Skip to content

Fix enum item sets conversion

Ivan Sinkarenko requested to merge isinkare/pyjapc:fix/enum-item-set into master

I believe this might have been broken after switch to jpype 0.7, as internal properties became forbidden, one has to use getter methods.

Proof of concept:

Python 3.6.5 (default, Jun 15 2019, 23:43:46)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyjapc
>>> japc = pyjapc.PyJapc(incaAcceleratorName='', selector='')
/opt/isinkare/projects/devenv/lib/python3.6/site-packages/jpype/_core.py:218: UserWarning:
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False.  The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------

  """)
>>> japc.getParam('KFA45.867.FIDS.dumpSwitch/SettingRegisters#ModuleParam', noPyConversion=False)
Traceback (most recent call last):
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 729, in _processTempValue
    vals, heads = self._convertParGroupToPy(temp_value, unixtime)
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 1449, in _convertParGroupToPy
    for fspv in failSafeParValues:
TypeError: 'cern.japc.core.spi.AcquiredParameterValueImpl' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 580, in getParam
    return self._processTempValue(temp_value=temp_val, getHeader=getHeader, noPyConversion=noPyConversion, unixtime=unixtime)
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 742, in _processTempValue
    val = self._convertValToPy(parValue)
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 1430, in _convertValToPy
    return self._convertSimpleValToPy(val)
  File "/opt/isinkare/projects/devenv/lib/python3.6/site-packages/pyjapc/pyjapc.py", line 1382, in _convertSimpleValToPy
    return [(v.code, v.string) for v in val.value]
AttributeError: 'cern.japc.value.spi.value.simple.EnumSetValue' object has no attribute 'value'
Edited by Ivan Sinkarenko

Merge request reports