Reading a vtp file give an error

Hi, I am new in this community. I try to read a vtp file, it is a DTC hull which can be read by Paraview.


I write a python script to read this file :slight_smile:

import vtk

filename = "hull.vtp"
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName(filename)
reader.Update()
polydata = reader.GetOutput()

but I have an error :

ERROR: In vtkXMLReader.cxx, line 341
vtkXMLPolyDataReader (000001949E6459B0): Error opening file hull.vtp

ERROR: In vtkExecutive.cxx, line 730
vtkCompositeDataPipeline (0000019484C13260): Algorithm vtkXMLPolyDataReader (000001949E6459B0) returned failure for request: vtkInformation (000001949D6CE050)
  Debug: Off
  Modified Time: 172
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_INFORMATION
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1

Maybe someone can help me please ! Thanks a lot

Hi @bardina

Please share your file.

best,

Sorry, new users can not upload attachments.

In any case, it is probably too big to share here, you can use wetransfer.com instead :slight_smile:

It works well here. How did you install VTK ?

I have a Windows pc with VSCode and I have write this commands in terminal of VSCode :
PS C:\Users\amelie> python -m venv venv
PS C:\Users\amelie> .\venv\Scripts\activate
(venv) PS C:\Users\amelie> pip install vtk

import vtk

Understood, more investigation needed to understand why this is happening on your side.