Hi,
I think that ParaView's python package should provide a mechanism to import
all vtk modules. The site-packages/paraview/vtk directory includes .py
files for each vtk module, but the __init__.py file only imports a subset
of them. As far as I can tell, it's up to the user to import individual
modules by name.
Here's a code snippet that inspects the site-packages/paraview/vtk
directory and imports all vtk*.py files.
import os
import glob
try:
# this works for vtkpython
from vtk import *
except ImportError:
# this works for pvpython
import paraview.vtk
baseDir = os.path.dirname(paraview.vtk.__file__)
for f in glob.glob(os.path.join(baseDir, 'vtk*.py')):
moduleName = os.path.splitext(os.path.basename(f))[0]
exec('from paraview.vtk.%s import *' % moduleName)
I usually put this code into a file named vtkAll.py and then my scripts can
do:
import vtkAll as vtk
And that will work with vtkpython and pvpython.
Pat
_______________________________________________
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