Paraview 5.8.0 crashes when using vtkXMLPolyDataReader in Programmable Source

Running ParaView 5.8.0-Windows-Python3.7-msvc2015-64bit on Windows 10 Version 1903 on GTX 1080 Driver Version 451.67 with Python Version 3.7.8:4b47a5b6ba I tried using a Python wrapped vtkXMLPolyDataReader in the script part of a Programmable Source.

import vtk
from paraview.vtk.vtkIOXML import vtkXMLPolyDataReader
SourceFile=vtkXMLPolyDataReader(Path/to/test.vtp)

Paraview freezes when pressing Apply and then closes. The files reads fine, when using the GUI load menu option or the Python Shell. The only error message I found is from the windows event viewer.
Because the error log is too long, here a pastebin link: Crash report.

I am not sure if that’s the issue, but you should remove the import vtk. That’s unnecessary.

As suggested I tried removing import vtk, no change in behaviour. Would have been too easy.

here is a working example

from paraview.vtk.vtkIOXML import vtkXMLPolyDataReader
sourceFile=vtkXMLPolyDataReader()
sourceFile.SetFileName("path/to/file.vtp")
sourceFile.Update()
pdo = self.GetPolyDataOutput()
pdo.ShallowCopy(sourceFile.GetOutput())
1 Like

I’d just add that DeepCopy is not necessary, and just a ShallowCopy would suffice and is generally better here.

1 Like

Thank you for providing a working example.

Right, I’ve updated the example.