[vtkusers] Python-VTK: modules seem fine but names are not defined

Angelo Tardugno angelo.tardugno at gmail.com
Wed Jun 25 05:38:10 EDT 2008


I've been trying to set up python to work with vtk for the past three days
but I'm stuck.

Under Windows nothing seems to work...I can compile vtk after I've turned on
the shared lib options and the python wrapping but neither vtkpython nor
python work (I've tried all the possible solutions I found on various
mailing lists but with no success). So i decided to try on linux (btw I've
got Ubuntu)...things seemed to go pretty well...I've compiled python 2.5.2,
then installed Cmake. Using Cmake I changed the compiling option for vtk
turning on the shared library option and the python wrappings..make & make
install..went for a couple of coffes...set all the environment
variables..launched python with an example I found on internert...nothing.

By chance I discovered that the actual module I have to lode is not called
libVTKCommonPython but libvtkCommonPython...importing this module works fine
and also libvtkGraphicsPython is imported (I checked by doing >> import sys
>> print sys.modules). The thing is if I try to type in the following line
(ren=vtkRenderer()) I get a message saying

NameError: name 'vtkRenderer' is not defined

However if I type in cone=vtkConeSource() everything works. I think there
must be something wrong with some of the libraries.

I tried to import from libvtkRendereingPython but I got this message:

ImportError: /usr/lib/libvtkRenderingPythonD.so.5.0: undefined symbol:
_ZN16vtkGL2PSExporter24SetGlobalLineWidthFactorEf

That's pretty strange since I didn't enable the GL2PS support...

Anybody can help?

Thanks

Angelo

P.S. here's the script I used for testing


#! /usr/bin/python

# load VTK extensions
from libVTKCommonPython import *
from libVTKGraphicsPython import *

# create a rendering window and renderer
ren = vtkRenderer()
renWin = vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(300,300)

iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# create an actor and give it cone geometry
cone = vtkConeSource()
cone.SetResolution(8)
coneMapper = vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneActor = vtkActor()
coneActor.SetMapper(coneMapper)

# assign our actor to the renderer
ren.AddActor(coneActor)

# enable user interface interactor
iren.Initialize()
iren.Start()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080625/d0ae4b82/attachment.htm>


More information about the vtkusers mailing list