Failed to Create Object Error

I’m using the binary version for Windows from paraview.org 5.11.0

I loaded my python plugin into ParaView without any problems but when I try to load a data file using the plugin
I get a “Failed to create object” error. How can I resolve this error so that I am able to read the data file properly.

image

Here is the code I used for the plugin.

from vtkmodules.numpy_interface import dataset_adapter as dsa
from vtkmodules.vtkCommonDataModel import vtkDataSet
import numpy as np

@smproxy.reader(name="PythonHDFReader", label="Python-based HDF Reader",
                extensions="hdf", file_description="HDF files")
@smproperty.input(name="Input", port_index=0)
@smdomain.datatype(dataTypes=["vtkPointSet"])
@smdomain.xml("""<InputArrayDomain attribute_type="point" name="input_normal" number_of_components="3" />""")

class HDF5Reader(VTKPythonAlgorithmBase):
    def __init__(self):
        super().__init__(nInputPorts=1, nOutputPorts=1, outputType="vtkPointSet")
        self.WarpFactor = 1.0
        self.NormalArray = ""

        return 1

    def RequestData(self, request, inInfo, outInfo):
        from vtkmodules.vtkCommonDataModel import imageToVTK
        from vtkmodules.numpy_interface import dataset_adapter as dsa
                
        output = vtkPolyData.GetData(outInfo)
          
        return 1

What is imageToVTK? I don’t see anything with this name in VTK itself.

That said, it shouldn’t interfere with the __init__ since it is in RequestData. We should probably get this error to surface the Python exception that (probably) happened.

It seems we do using PyErr_Print() which means it’s probably sitting in a terminal (or ignored) somewhere. We should try to redirect this to ParaView’s logging APIs though.

Issue filed: https://gitlab.kitware.com/paraview/paraview/-/issues/22121