Issue with threshold after generate normals in python.

hello,

I am running the following lines of code:

if sliceFilter==[]:
    sliceFilter= GetActiveSource()

originOfSlice=sliceFilter.SliceType.Origin
sliceFilterMerged=MergeBlocks(registrationName='MergeBlocks1', Input=sliceFilter)

transform1 = Transform(registrationName='Transform1', Input=sliceFilterMerged)
transform1.Transform.Translate = [-i for i in originOfSlice]

anglesToRotate = angles_to_align_with_z(normalOfSlice)
transform2 = Transform(registrationName='Transform1', Input=transform1)
transform2.Transform.Rotate = anglesToRotate

extractSurface1 = ExtractSurface(registrationName='ExtractSurface1', Input=transform2)

surfaceNormals = SurfaceNormals(registrationName='SurfaceNormals1', Input=extractSurface1)

filterForFlags = Threshold(registrationName='Threshold1', Input=surfaceNormals)
filterForFlags.Scalars = ['POINTS', 'Normals']
filterForFlags.SelectedComponent = 'Z'
filterForFlags.LowerThreshold = -100000000000000
filterForFlags.UpperThreshold = 0

but I having the following error: when running it:

Traceback (most recent call last):
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 519, in __setattr__
    setter(self, value)
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 2979, in setProperty
    return self.SetPropertyWithName(propName, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 361, in SetPropertyWithName
    prop.SetData(arg)
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 1176, in SetData
    convertedValues = list(map(self.ConvertValue, values))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 1296, in ConvertValue
    raise ValueError("%s is not a valid value." % value)
ValueError: Z is not a valid value.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 523, in __setattr__
    setter(self, _make_name_valid(value))
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 2979, in setProperty
    return self.SetPropertyWithName(propName, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 361, in SetPropertyWithName
    prop.SetData(arg)
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 1176, in SetData
    convertedValues = list(map(self.ConvertValue, values))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 1296, in ConvertValue
    raise ValueError("%s is not a valid value." % value)
ValueError: Z is not a valid value.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 527, in __setattr__
    _bc.setattr_fix_value(self, name, value, setter)
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/_backwardscompatibilityhelper.py", line 680, in setattr_fix_value
    raise ValueError("'%s' is not a valid value for %s!" % (value, pname))
ValueError: 'Z' is not a valid value for SelectedComponent!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "<console>", line 20, in exportSvgOfSlice
  File "/home/franco/Programs/ParaView/ParaView-6.0.1-MPI-Linux-Python3.12-x86_64/lib/python3.12/site-packages/paraview/servermanager.py", line 531, in __setattr__
    raise ValueError("%s is not a valid value for attribute %s." % (value, name))
ValueError: Z is not a valid value for attribute SelectedComponent.

As it can be seen in the message error, it does not find the Z component, but while runned, this will create the corresponding filters on the pipeline browser, if once runned (and the filters created) i hit on the eye to show the surfaceNormals filter, and then hit the eye on the threshold, i can select points/Normals and Z component without issues.
not sure what i am missing.

okey a `UpdatePipeline()` before the threshold solved the issue. this keeps happening to me, need to rememeber this for next time…