PythonScript filter does not work with Load State
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
If you try to Load State when there is a PythonScript Filter present, the XML parser complains. The relevant XML is below and the error occurs after 'data=pdi.GetPointData().GetArray("Temp") '. It appears that the quotes in the python script are not escaped so they interact with the quotes in the XML.
<Proxy group="filters" type="PythonScript" id="159">
<Property name="Input" id="159.Input" number_of_elements="1">
<Proxy value="250"/>
<Domain name="groups" id="159.Input.groups">
<Group value="sources"/>
<Group value="filters"/>
</Domain>
<Domain name="input_type" id="159.Input.input_type">
<DataType value="vtkDataSet"/>
</Domain>
</Property>
<Property name="OutputDataSetType" id="159.OutputDataSetType" number_of_elements="1">
<Element index="0" value="0"/>
<Domain name="enum" id="159.OutputDataSetType.enum">
<Entry value="8" text="Same as Input"/>
<Entry value="0" text="vtkPolyData"/>
<Entry value="2" text="vtkStructuredGrid"/>
<Entry value="3" text="vtkRectilinearGrid"/>
<Entry value="4" text="vtkUnstructuredGrid"/>
<Entry value="6" text="vtkImageData"/>
</Domain>
</Property>
<Property name="Script" id="159.Script" number_of_elements="1">
<Element index="0" value="import sys
pdi = self.GetUnstructuredGridInput() pdo = self.GetPolyDataOutput() newPts = paraview.vtkPoints() numPts = pdi.GetNumberOfPoints() data=pdi.GetPointData().GetArray("Temp") outData=paraview.vtkDoubleArray() outData.SetName("Output") for i in range(0, numPts): coord = pdi.GetPoint(i) x,y,z = coord[:3] x = x * 2 y = y * 0.5 z = 1 newPts.InsertPoint(i, x,y,z) coorddata=data.GetValue(i) outData.InsertNextValue(coorddata*100) pdo.SetPoints(newPts) pdo.GetPointData().AddArray(outData) pdo.GetPointData().AddArray(data)"/> </Property> </Proxy>