[Paraview] python and *.vtk

llapis Pencil llapispencil at yahoo.es
Thu Jul 15 09:00:27 EDT 2010


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


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100715/de46a07a/attachment.htm>


More information about the ParaView mailing list