[vtkusers] python wrapping local classes

Ed Bachta ebachta at iupui.edu
Thu Aug 28 14:46:22 EDT 2003


Thanks for the suggestion, but that didn't do it...

[ebachta at jackson vtkHistogramColorBar]$ vtkpython
vtk version 4.3.0, vtk source $Revision: 1.1610 $, $Date: 2003/06/23
01:45:05 $
(GMT)
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from vtkpython import *
>>> ren = vtk.vtkRenderer()
>>> hcb = vtk.vtkHistogramColorBar()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'vtkHistogramColorBar'
>>> from libvtkLocalPython import *
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: /usr/local/src/VTK/bin/libvtkLocalPython.so: undefined
symbol: PyVTKClass_vtkActor2DNew
>>>

Btw, this is what my Local/CMakeLists.txt looks like (before the "common
section" that I pasted in):

SET(KIT Local)
SET(UKIT LOCAL)
SET(KIT_PYTHON_LIBS vtkCommonPython)
SET(KIT_LIBS vtkCommon)
                                                                                
SET( Kit_SRCS
vtkHistogramColorBar.cxx
)
                                                                                
SET(Kit_EXTRA_SRCS)
SET(Kit_EXTRA_CMDS)
SET(Kit_TCL_EXTRA_SRCS)
SET(Kit_PYTHON_EXTRA_SRCS)
SET(Kit_JAVA_EXTRA_SRCS)


- Ed

On Thu, 2003-08-28 at 13:30, Leila Baghdadi wrote:
> Hi Ed
> 
> you must try loading
> 
> from vtkpython import *
> from libvtkLocalPython import *
> 
> 
> hope this helps
> 
> 
> Leila
> 
> On 28 Aug 2003, Ed Bachta wrote:
> 
> > 
> > Hello vtkusers,
> > 
> > I'm trying to add a class to my VTK build. I was able to add it to a
> > directory called Local and build a C++ .so nicely by following the
> > suggestions in the VTK README. I can even create a C++ application that
> > uses the class. However, I'm having trouble with the python wrapping. I
> > seem to get a libvtkLocalPython.so in the bin directory, but when I try
> > using my class in a script I have problems. First, it doesn't seem to be
> > in the vtk module:
> > 
> > -----
> > [ebachta at jackson Blondin]$ vtkpython
> > vtk version 4.3.0, vtk source $Revision: 1.1610 $, $Date: 2003/06/23
> > 01:45:05 $
> > (GMT)
> > Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
> > [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import vtk
> > >>> ren = vtk.vtkRenderer()
> > >>> h = vtk.vtkHistogramColorBar()
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > AttributeError: 'module' object has no attribute 'vtkHistogramColorBar'
> > -----
> > 
> > And if I try loading from the python library for Local directly it has
> > problems with undefined symbols:
> > 
> > -----
> > >>> from libvtkLocalPython import *
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > ImportError: /usr/local/src/VTK/bin/libvtkLocalPython.so: undefined
> > symbol: PyVTKClass_vtkActor2DNew
> > -----
> > 
> > I'm suspecting that I'm missing something in my Local/CMakeLists.txt,
> > but I don't know what that would be. I'm working on a Linux box.
> > 
> > 
> 
> 




More information about the vtkusers mailing list