[vtkusers] Problem with python wrapping

Armin Wehrfritz dkxls23 at gmail.com
Thu Mar 26 11:25:36 EDT 2015


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")

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.

Thanks David for the link to the CMakeLists.txt in the vtk-dicom repo. 
Apparently the python wrapping is a bit more involved. I will have to 
take a closer look at that one.

Best regards,
Armin







On 03/25/2015 03:38 PM, David Gobbi wrote:
> On Wed, Mar 25, 2015 at 7:12 AM, AI <odre_89 at hotmail.com
> <mailto:odre_89 at hotmail.com>> wrote:
>
>     Hi David,
>
>     Thank you very much for your answer.
>     Now I was able to run cmake, but there is no .so file in the
>     build/bin of my
>     project. I must miss something else in my CMakeLists.txt...
>
>
> You are probably missing the add_library() commands, e.g.:
>    add_library(${LIB_PYTHON_NAME} ${LIB_PYTHON_SRCS}
> ${LIB_PYTHON_EXTRA_SRCS})
>    add_library(${MODULE_PYTHON_NAME} MODULE ${MODULE_PYTHON_NAME}Init.cxx)
>
> There are a lot of other things that are needed as well, for example
> here is one of my own CMakeLists files that generates python wrappers:
> https://github.com/dgobbi/vtk-dicom/blob/master/Source/CMakeLists.txt#L163
>
> Perhaps someone else has found an easier way to do this...
>
>   - David
>
>
> _______________________________________________
> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


More information about the vtkusers mailing list