Cannot set threshold.SelectedComponent to Magnitude from python script saved from python state (or python trace)
I am using Paraview 5.12 and try to set the threshold filter using the magnitude of a vector variable from python. If I prepare everything in Paraview it works fine, but when I then save the state to a python file and run it again (from the python shell), I get the message:
Traceback (most recent call last):
File "D:\Program Files\ParaView-5.12.0-Windows-Python3.10-msvc2017-AMD64\bin\Lib\site-packages\paraview\servermanager.py", line 485, in __setattr
setter(self, value)
File "D:\Program Files\ParaView-5.12.0-Windows-Python3.10-msvc2017-AMD64\bin\Lib\site-packages\paraview\servermanager.py", line 2618, in setProperty
return self.SetPropertyWithName(propName, value)
File "D:\Program Files\ParaView-5.12.0-Windows-Python3.10-msvc2017-AMD64\bin\Lib\site-packages\paraview\servermanager.py", line 344, in SetPropertyWithName
prop.SetData(arg)
File "D:\Program Files\ParaView-5.12.0-Windows-Python3.10-msvc2017-AMD64\bin\Lib\site-packages\paraview\servermanager.py", line 859, in SetData
convertedValues = list(map(self.ConvertValue, values))
File "D:\Program Files\ParaView-5.12.0-Windows-Python3.10-msvc2017-AMD64\bin\Lib\site-packages\paraview\servermanager.py", line 977, in ConvertValue
raise ValueError("%s is not a valid value." % value)
ValueError: Magnitude is not a valid value.
The error can be reproduced by running the attached python script (threshold.py)) from the python shell. Interestingly, if I insert calculator1.UpdatePipeline() before the creation of the threshold, it does work fine (see threshold_ok.py). Is this intended behaviour?