Using colorBy(rep,value=None)
in a python script results in the following error:
>>> Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/paraview/servermanager.py", line 3190, in GetAssociationFromString
return ASSOCIATIONS[val]
KeyError: 'NONE'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/paraview/servermanager.py", line 3193, in GetAssociationFromString
return _LEGACY_ASSOCIATIONS[val]
KeyError: 'NONE'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 59, in <module>
File "<string>", line 53, in __streamlines
File "/usr/lib/python3.9/site-packages/paraview/simple.py", line 581, in ColorBy
rep.SetScalarColoring(None, servermanager.GetAssociationFromString(association))
File "/usr/lib/python3.9/site-packages/paraview/servermanager.py", line 3195, in GetAssociationFromString
raise RuntimeError ("invalid association string '%s'" % val)
RuntimeError: invalid association string 'NONE'
>>>
The following logic is executed.
In paraview/simple.py from line 580
if value == None:
rep.SetScalarColoring(None, servermanager.GetAssociationFromString(association))
In paraview/servermanager.py from line 3185
def GetAssociationFromString(val):
"""Returns array association integer value from its string representation"""
global ASSOCIATIONS, _LEGACY_ASSOCIATIONS
val = str(val).upper()
try:
return ASSOCIATIONS[val]
except KeyError:
try:
return _LEGACY_ASSOCIATIONS[val]
except KeyError:
raise RuntimeError ("invalid association string '%s'" % val)
None of the dictionaries (ASSOCIATIONS and _LEGACY_ASSOCIATIONS have a ‘NONE’ key.
ASSOCIATIONS = { 'POINTS' : 0, 'CELLS' : 1, 'FIELD' : 2, 'VERTICES' : 4, 'EDGES' : 5, 'ROWS' : 6}
_LEGACY_ASSOCIATIONS = { 'POINT_DATA' : 0, 'CELL_DATA' : 1 }