[Paraview] python and *.vtk

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Jul 15 10:26:26 EDT 2010


There's a bug in 3.8.0 in OpenDataFile() which will be fixed in 3.8.1
(already fixed in release branch). Use the attached script as a
sample. It has a newer fixed version of OpenDataFile().

The second sample you used was incorrect since you are mixing
VTK-python  scripting with ParaView's python scripting.

Utkarsh




On Thu, Jul 15, 2010 at 9:00 AM, llapis Pencil <llapispencil at yahoo.es> wrote:
> Hi once again,
>
> I still haven't achieve to open the *.vtk file with a python script. I tried
> mainly two different ways:
>
> 1. Has you said, with the OpenDataFile command. But I get the error below,
> as it could not read *.vtk file.
>
> #Python script
> from paraview.simple import *
> reader = OpenDataFile("C:/Documents and
> Settings/Nit@/Escritorio/pet/out1-1.vtk")
> Show(reader)
> Render()
> ##########
>
> #error on the python shell
> Traceback (most recent call last):
>
> File "<string>", line 2, in <module>
>
> File "C:\Archivos de programa\ParaView
> 3.8.0\lib\paraview-3.8\paraview\simple.py", line 115, in OpenDataFile
>
> reader = globals()[xml_name](FileName=filename, **extraArgs)
>
> File "C:\Archivos de programa\ParaView
> 3.8.0\lib\paraview-3.8\paraview\simple.py", line 542, in CreateObject
>
> setattr(px, param, params[param])
>
> File "C:\Archivos de programa\ParaView
> 3.8.0\lib\paraview-3.8\paraview\servermanager.py", line 201, in __setattr__
>
> "to add this attribute.")
>
> AttributeError: Attribute FileName does not exist. This class does not allow
> addition of new attributes to avoid mistakes due to typos. Use
> add_attribute() if you really want to add this attribute.
>
> ##########
>
> Do someone know what should I change or what 's wrong?
>
> 2. I searched for a specific vtk reader and I found in internet
> (https://visualization.hpc.mil/wiki/VTK_in_Python) the following solution
> and getting the following error:
>
> #python script
> from vtk import *;
> reader = vtkDataSetReader()
> reader.SetFileName("out1-1.vtk")
> Show(reader4)
> Render()
> ###########
>
> #error on the python shell
> Traceback (most recent call last):
>
> File "<string>", line 1, in <module>
>
> ImportError: No module named vtk
>
> ###########
>
> I download the vtk source http://www.vtk.org/VTK/resources/software.html and
> installed the latest verion for Windows. If I had not understood bad I made
> what was necessary
> (https://visualization.hpc.mil/wiki/Getting_Started_with_VTK).
>
> But still doesn't recognize the vtk library. Does someone know what's wrong?
> or how paraview could recognize the vtk library?
>
> Thanks you for advance and sorry for the inconviniences.
>
> Llapis
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.py
Type: text/x-python
Size: 1215 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100715/760fee64/attachment-0001.py>


More information about the ParaView mailing list