how to adjust / specify normals in programmable filter

How do you adjust the Normals using programmable filter like described here
[Paraview] normals in programmable filter

I have been using the script below, but get the following error message
AttributeError: ‘NoneType’ object has no attribute ‘NewInstance’

od = self.GetOutput()
id = self.GetInput()
od.GetPointData().ShallowCopy(id.GetPointData())
innorm = od.GetPointData().GetNormals()
onorm = innorm.NewInstance()
onorm.DeepCopy(innorm)
onorm.SetName(“NewNormals”)
for x in range(0, onorm.GetNumberOfTuples()):
a,b,c = onorm.GetTuple(x)
print a,b,c
a = -1a
b = -1
b
c = -1*c
onorm.SetTuple3(x, a,b,c)
od.GetPointData().SetNormals(onorm)

Hi @garcfd

od point data do not contains normals, so your innorm is empty

Best,

Hi Matt, thanks for the reply. I have a vtk file which is a slice of mesh (from openfoam sampling), with velocity values. Couple of the cells have wrong normal, since the colouring is off. I can reverse all the normals. If I triangulate the mesh it fixes the problem, but I dont want to do that. So basically I want to be able to loop through the cells and set all the normals in same direction. If you have any idea how to do that - it would be useful, Thanks Giles.