[vtkusers] Problem with python wrapping

David Gobbi david.gobbi at gmail.com
Thu Mar 26 11:57:51 EDT 2015


On Thu, Mar 26, 2015 at 9:25 AM, Armin Wehrfritz <dkxls23 at gmail.com> wrote:

> Hi,
>
> I have also tried to get the python wrapping working, but failed at
> various levels.
> A good starting point is the VTK wiki:
> http://www.vtk.org/Wiki/index.php?title=VTK/Python_Wrapping_FAQ
>
> But the wiki is missing already the information to add
>
>> SET(VTK_WRAP_PYTHON_FIND_LIBS ON)
>> INCLUDE("${VTK_CMAKE_DIR}/vtkWrapPython.cmake")
>>
>
That wiki page was written for VTK developers, so it doesn't give much
useful info for people who are building their own libraries, unfortunately.


Anyway, I figured that one out eventually by grepping the source code, and
> I also find my *.so files, but when I try to load the module I get an
> "undefined symbol" error:
>
>> import vtkMyFilterPython
>> ------------------------------------------------------------
>> ---------------
>> ImportError                               Traceback (most recent call
>> last)
>> <ipython-input-1-3c0a51434210> in <module>()
>> ----> 1 import vtkMyFilterPython
>>
>> ImportError: ./vtkMyFilterPython.so: : real_initvtkMyFilterPython
>>
>
>
> If somebody has any hint, I would be happy to learn more, though it's not
> a pressing matter for me.


The undefined symbol error probably means that your python module doesn't
include vtkMyFilterPythonInit.cxx, which is one of the files generated by
vtk_wrap_python3().

Your cmake should include the Init.cxx as a source file when it builds the
module, e.g.:

add_library(vtkMyFilterPython MODULE vtkMyFilterPythonInit.cxx)

Or, if that still doesn't fix the problem, then there might be an error in
your add_library call for vtkMyFilterPythonD.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150326/9b039eb8/attachment.html>


More information about the vtkusers mailing list