Problem with generated python script

Hey everyone,

I am having a problem with a generated python script in paraview. The script is auto-generated using the trace functionality.

This is the script:

# trace generated using paraview version 5.10.0-RC1
#import paraview
#paraview.compatibility.major = 5
#paraview.compatibility.minor = 10

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'OpenFOAMReader'
foamcase = OpenFOAMReader(registrationName='open.foam', FileName='open.foam')
foamcase.MeshRegions = ['internalMesh']
foamcase.CellArrays = ['K_', 'U', 'alpha.liquid', 'interfaceCentre.liquid', 'interfaceNormal.liquid', 'p', 'p_rgh']

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

# Properties modified on foamcase
foamcase.SkipZeroTime = 0
foamcase.CellArrays = ['U']

UpdatePipeline(time=0.1, proxy=foamcase)

# Properties modified on foamcase
foamcase.SkipZeroTime = 1

# Properties modified on foamcase
foamcase.SkipZeroTime = 0

animationScene1.GoToFirst()

# create a new 'Calculator'
calculator1 = Calculator(registrationName='Calculator1', Input=foamcase)
calculator1.Function = ''

# Properties modified on calculator1
calculator1.ResultArrayName = 'KE'
calculator1.Function = '0.5*U^2'

UpdatePipeline(time=0.0, proxy=calculator1)

# create a new 'Integrate Variables'
integrateVariables1 = IntegrateVariables(registrationName='IntegrateVariables1', Input=calculator1)

UpdatePipeline(time=0.0, proxy=integrateVariables1)

SelectIDs(IDs=[-1, 0], FieldType=1, ContainingCells=0)

# set active source
SetActiveSource(integrateVariables1)

UpdatePipeline(time=0.0, proxy=plotSelectionOverTime1)

# save data
SaveData('postProcessing/KEDissipation.csv', proxy=plotSelectionOverTime1, RowDataArrays=['N', 'Time', 'avg(KE (0))', 'avg(KE (1))', 'avg(KE (2))', 'avg(KE (Magnitude))', 'avg(U (0))', 'avg(U (1))', 'avg(U (2))', 'avg(U (Magnitude))', 'avg(X)', 'avg(Y)', 'avg(Z)', 'avg(vtkOriginalPointIds)', 'max(KE (0))', 'max(KE (1))', 'max(KE (2))', 'max(KE (Magnitude))', 'max(U (0))', 'max(U (1))', 'max(U (2))', 'max(U (Magnitude))', 'max(X)', 'max(Y)', 'max(Z)', 'max(vtkOriginalPointIds)', 'med(KE (0))', 'med(KE (1))', 'med(KE (2))', 'med(KE (Magnitude))', 'med(U (0))', 'med(U (1))', 'med(U (2))', 'med(U (Magnitude))', 'med(X)', 'med(Y)', 'med(Z)', 'med(vtkOriginalPointIds)', 'min(KE (0))', 'min(KE (1))', 'min(KE (2))', 'min(KE (Magnitude))', 'min(U (0))', 'min(U (1))', 'min(U (2))', 'min(U (Magnitude))', 'min(X)', 'min(Y)', 'min(Z)', 'min(vtkOriginalPointIds)', 'q1(KE (0))', 'q1(KE (1))', 'q1(KE (2))', 'q1(KE (Magnitude))', 'q1(U (0))', 'q1(U (1))', 'q1(U (2))', 'q1(U (Magnitude))', 'q1(X)', 'q1(Y)', 'q1(Z)', 'q1(vtkOriginalPointIds)', 'q3(KE (0))', 'q3(KE (1))', 'q3(KE (2))', 'q3(KE (Magnitude))', 'q3(U (0))', 'q3(U (1))', 'q3(U (2))', 'q3(U (Magnitude))', 'q3(X)', 'q3(Y)', 'q3(Z)', 'q3(vtkOriginalPointIds)', 'std(KE (0))', 'std(KE (1))', 'std(KE (2))', 'std(KE (Magnitude))', 'std(U (0))', 'std(U (1))', 'std(U (2))', 'std(U (Magnitude))', 'std(X)', 'std(Y)', 'std(Z)', 'std(vtkOriginalPointIds)', 'vtkValidPointMask'],
    FieldAssociation='Row Data')

When I run it using the pvpython interpreter, I get the following error message:

Traceback (most recent call last):
  File "*[private path removed]*/calcKE.py", line 51, in <module>
    SelectIDs(IDs=[-1, 0], FieldType=1, ContainingCells=0)
  File "*[private path removed]*/ParaView-5.10.1/lib/python3.9/site-packages/paraview/selection.py", line 371, in SelectIDs
    _selectIDsHelper('IDSelectionSource', **locals())
  File "*[private path removed]*/ParaView-5.10.1/lib/python3.9/site-packages/paraview/selection.py", line 314, in _selectIDsHelper
    repr = paraview.simple.GetRepresentation(Source)
  File "*[private path removed]*/ParaView-5.10.1/lib/python3.9/site-packages/paraview/simple.py", line 706, in GetRepresentation
    raise ValueError ("view argument cannot be None.")
ValueError: view argument cannot be None.

Does anybody know what the problem is? Any help is highly appreciated!

Hi Spacenerd, Welcome to the ParaView community!

I don’t know your issue, but would suggest updating to ParaView 5.11.0. It looks like you are trying to trace a selection, and I believe there were issues that were fixed. Next, if that doesn’t work, try giving us the detailed steps used to create the issue. An easy thing to do is try it on one of the Example datasets. Then, we need * load dataset. * clip. * Save Data. Stop trace. Run trace as follows. This type of detail

Thanks

Thank you for your help!

I tried the same thing using version 5.11.0 but the same error occured.

However, as you pointed out, the error seems to originate from the selection process. I tried the same thing with the filter “plot data over time” instead of “plot selection over time” and it worked. That way, I was able to circumvent the selection process.

This might be a bug, I don’t know but with the workaround I explained, it works fine.

Hello ! I have an issue with my python script, I don’t know what is the problem. I am basically trying to launch one of the Paraview guide example (4. Displaying data — ParaView Documentation 5.10.1 documentation), the bluntfin.vts case. When I am typing all the commands in the script I get the following error :

Traceback (most recent call last):
File “C:/Program Files/blueCFD-Core-2020/AddOns/ParaView/bin\Lib/site-packages\paraview\python_view.py”, line 167, in call_render
image = render_function(view, width, height)
File “Script”, line 62, in render
File “C:/Program Files/blueCFD-Core-2020/AddOns/ParaView/bin\Lib/site-packages\vtkmodules\util\numpy_support.py”, line 215, in vtk_to_numpy
typ = vtk_array.GetDataType()
AttributeError: ‘NoneType’ object has no attribute ‘GetDataType’

Hopefully, someone can help me sort this out.
Thanks for your time