# pvpython integrateVariables filter and extract data

**URL:** https://discourse.paraview.org/t/pvpython-integratevariables-filter-and-extract-data/16287
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [March 10, 2025, 4:30pm UTC](https://discourse.paraview.org/t/pvpython-integratevariables-filter-and-extract-data/16287 "2025-03-10T16:30:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Emiliano\_Fortes](https://discourse.paraview.org/user_avatar/discourse.paraview.org/emiliano_fortes/32/16101_2.png) [@Emiliano\_Fortes](https://discourse.paraview.org/u/Emiliano_Fortes)
#### Post date: [March 10, 2025, 4:30pm UTC](https://discourse.paraview.org/t/pvpython-integratevariables-filter-and-extract-data/16287/1 "2025-03-10T16:30:40Z")

</div>

Hello dear community,

I am running pvbatch so save the integrated data of some slices. I’ve tried a lot of things, based on what I could find in the forum. What I do is:

```auto

from paraview.simple import *
import numpy as np

PATH_PVD = "inlet.pvd"

# create a new 'PVD Reader'
inletpvd = PVDReader(registrationName='inlet.pvd', 
    FileName=PATH_PVD)

Ly = 0.008
grid = np.arange(-Ly/2, Ly/2 + dy, dy)
vel = []
for iy, y in enumerate(grid):
    # create a new 'Slice'
    slice1 = Slice(registrationName='Slice1', Input=inletpvd)
    slice1.SliceType.Origin = [0.0, y, 0.0]

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

    integrateVariables1.UpdatePipeline()
    
    # Create a new 'SpreadSheet View'
    spreadSheetView1 = CreateView('SpreadSheetView')       

    # create a new 'Pass Arrays'
    passArrays1 = PassArrays(Input=integrateVariables1)
    passArrays1.PointDataArrays = ['VELOC:1']    

    # update the view to ensure updated data information
    spreadSheetView1.Update()

    ss_data = servermanager.Fetch(passArrays1)    
    vel.append(ss_data.GetPointData().GetArray('VELOC:1').GetValue(0))
    print(vel)

```

However, I get an error with the servermanager

```auto
Traceback (most recent call last):
  File "3_save_integrated_slices_data.py", line 74, in <module>
    ss_data = servermanager.Fetch(passArrays1)    
  File "Software/ParaView-5.11.0-osmesa-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/servermanager.py", line 2468, in Fetch
    opc = op.NewInstance()
AttributeError: 'NoneType' object has no attribute 'NewInstance'

```

I have tried many other things but I thought, based on what I’ve seen in the forum, that this was the correct way. I am a bit of at a loss how to proceed, if anyone has a hint

---

<div class="post-metadata">

### Author: ![Emiliano\_Fortes](https://discourse.paraview.org/user_avatar/discourse.paraview.org/emiliano_fortes/32/16101_2.png) [@Emiliano\_Fortes](https://discourse.paraview.org/u/Emiliano_Fortes)
#### Post date: [March 11, 2025, 8:42am UTC](https://discourse.paraview.org/t/pvpython-integratevariables-filter-and-extract-data/16287/2 "2025-03-11T08:42:42Z")

</div>

Fixed it… leaving the solution in case anyone else needs it:

```auto
for iy, y in enumerate(grid):
    # create a new 'Slice'
    slice1 = Slice(registrationName='Slice1', Input=inletpvd)
    slice1.SliceType.Origin = [0.0, y, 0.0]

    # create a new 'Integrate Variables'
    integrateVariables1 = IntegrateVariables(registrationName='IntegrateVariables1', Input=slice1)
    integrateVariables1.UpdatePipeline()
    SetActiveSource(integrateVariables1)

    smdata = servermanager.Fetch(integrateVariables1)
    vel_y = smdata.GetPointData().GetArray('VELOC').GetValue(1)
    intgtd_data_np["u_y"][iy] = vel_y

    # Clean up
    Delete(slice1)
    del slice1
    Delete(integrateVariables1)
    del integrateVariables1
    del smdata
print(intgtd_data_np["u_y"])

```
