# Paraview quits when I use the programmable source

**URL:** https://discourse.paraview.org/t/paraview-quits-when-i-use-the-programmable-source/5618
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [October 21, 2020, 8:19pm UTC](https://discourse.paraview.org/t/paraview-quits-when-i-use-the-programmable-source/5618 "2020-10-21T20:19:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CJustin](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cjustin/32/4929_2.png) [@CJustin](https://discourse.paraview.org/u/CJustin)
#### Post date: [October 21, 2020, 8:19pm UTC](https://discourse.paraview.org/t/paraview-quits-when-i-use-the-programmable-source/5618/1 "2020-10-21T20:19:13Z")

</div>

Hi there,

I don’t know if this is because of the programmable source I wrote or what, but Paraview quits if I apply the code below to the programmable source:  
`import numpy as np  
from paraview import vtk

fname = ‘Path/to/tmp.txt’  
ret = np.loadtxt(fname).view(complex)

def ani(i, x, omega):  
x = x \* np.exp(1j_omega_i)  
return np.real(x)

def ani\_2(i, x, omega):  
x = x \* np.exp(1j_omega_i)  
return np.imag(x)

N = 40  
omega = 2.\*np.pi / N

ret = np.loadtxt(fname).view(complex)  
numPoints = ret.shape[0] \* ret.shape[1]  
dims = [ret.shape[0], ret.shape[1], 1]  
output = self.GetOutput()  
output.SetDimensions(dims)

newPoints = vtk.vtkPoints()  
newPoints.Allocate(dims[0] \* dims[1] \* dims[2])

ca = vtk.vtkDoubleArray()  
ca.SetName(“temp”)  
ca.SetNumberOfComponents(2)  
ca.SetNumberOfTuples(numPoints)  
v = [0.0] \* 3  
val = ani(0, ret, omega)  
val2 = ani\_2(0, ret, omega)

for i in range(0, ret.shape[0]):  
for j in range(0, ret.shape[1]):  
x = i + 1  
y = j + 1  
z = 0  
newPoints.InsertPoint(i \* ret.shape[0] + j, x, y, z)  
ca.InsertTuple(i \* ret.shape[0] + j,(val[i][j], val2[i][j]))

pdo.SetPoints(newPoints)  
pdo.GetPointData().SetScalars(ca)  
`

May I check what might be the problem?  
Thanks!
