State script with calculator does not work in client-server mode
While using ParaView remotely to Andes at OLCF, I noticed a problem with python files that I saved as state files. (I am using ParaView 5.10.0, which is the latest version installed on OLCF.) The Python interpreter seems to have trouble setting enumerated properties from a string.
I can replicate the problem with the following steps.
- Connect to andes. (I suspect any remote server connection will have similar behavior, but I have not tested that.)
- Load a dataset with cell data. (I used can.ex2.)
- Create a
Calculator
filter. Set theAttribute Type
toCell Data
. Enter something (anything) for the script. - Save the state as a python file.
- Reset the session.
- Load the python file just created (either with load state or with the python shell).
- An error occurs here.
Here is the python script I created. The part of the script that creates the two pipeline objects is this:
# create a new 'IOSS Reader'
canex2 = IOSSReader(registrationName='can.ex2', FileName=['/ccs/home/kmorel/data/paraview-examples/can.ex2'])
canex2.ElementBlocks = ['block_1', 'block_2']
canex2.NodeBlockFields = ['accl', 'displ', 'vel']
canex2.ElementBlockFields = ['eqps']
canex2.NodeSets = []
canex2.SideSets = []
# create a new 'Calculator'
calculator1 = Calculator(registrationName='Calculator1', Input=canex2)
calculator1.AttributeType = 'Cell Data'
calculator1.Function = 'eqps'
The error seems to occur on the line calculator1.AttributeType = 'Cell Data'
. I suspect the problem is that the reader pipeline object is not updated before the calculator is created, and somehow the enumeration object is not set up correctly. For some reason, this only occurs in client-server mode. I don't see a problem when running locally.
The full error I get is here:
Traceback (most recent call last):
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 496, in __setattr__
setter(self, value)
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 2612, in setProperty
return self.SetPropertyWithName(propName, value)
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 355, in SetPropertyWithName
prop.SetData(arg)
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 866, in SetData
convertedValues = list(map(self.ConvertValue, values))
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 984, in ConvertValue
raise ValueError("%s is not a valid value." % value)
ValueError: Cell Data is not a valid value.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 500, in __setattr__
_bc.setattr_fix_value(self, name, value, setter)
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/_backwardscompatibilityhelper.py", line 467, in setattr_fix_value
raise ValueError("'%s' is not a valid value for %s!" % (value, pname))
ValueError: 'Cell Data' is not a valid value for AttributeType!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 63, in <module>
File "/Applications/ParaView-5.10.0.app/Contents/Python/paraview/servermanager.py", line 504, in __setattr__
raise ValueError("%s is not a valid value for attribute %s." % (value, name))
ValueError: Cell Data is not a valid value for attribute AttributeType.