pythontarvtkramparaview

Pass loaded file location in RAM to function which need file name


I have a python VKT function XMLPolyDataReader which needs as argument a file location on the disk such as XMLPolyDataReader('file.vtp').

Due due space issues I save all my *.vtp file as tar.gz.

Now I want to run some work which need some of the files located in the tar-file. For this I use the tutorial from https://www.askpython.com/python-modules/tarfile-module to extract a single file such as : file=file_obj.extractfile("sample.vtp").

Now file is loaded and located in the RAM. Is there a possibility to pass it directly to the XMLPolyDataReader function without writing it in a temporary file, which is then loaded again by the XMLPolyDataReader function?


Solution

  • This is not supported.

    You can use .vtk file format instead of .vtp, as the vtkPolyDataReader can read from a string (so basically from RAM)

    Edit

    Note that there is a work in progress to enable this kind of feature on more reader. See this VTK forum post