<div dir="ltr">Hi devs,<div><br></div><div>I'm working on a VTK 7 based project that I'm trying to wrap in python. I'm stuck at a point where the project builds but the python library cannot be included. I'm doing the following in my CMakeLists.txt file:</div><div><div style="font-size:12.8px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br class="">SET(SRCS</div><div> ....</div><div> )</div><div><br></div><div>SET_SOURCE_FILES_PROPERTIES(</div><div> <subset of SRCS></div><div> PROPERTIES</div><div> WRAP_EXCLUDE 1</div><div> WRAP_EXCLUDE_PYTHON 1</div><div> )</div><div><br></div><div>SET(VTK_LIBRARIES</div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div> <vtk libraries></div><div> )</div><div><br></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>SET(KIT_PYTHON_LIBRARIES ${VTK_LIBRARIES})</div><div><br></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">SET(LIBRARY_MODE "SHARED")</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br></div><div>INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake)</div><div>VTK_WRAP_PYTHON3(${LIB_NAME}Python PYTHON_SRCS "${SRCS}")</div><div>ADD_LIBRARY(${LIB_NAME}PythonD ${LIBRARY_MODE} ${PYTHON_SRCS})</div><div>ADD_LIBRARY(${LIB_NAME}Python MODULE ${LIB_NAME}PythonInit.cxx)</div><div><br></div><div>TARGET_LINK_LIBRARIES(${LIB_NAME}PythonD ${LIB_NAME})</div><div><br></div><div>FOREACH(c ${KIT_PYTHON_LIBRARIES})</div><div> TARGET_LINK_LIBRARIES(${LIB_NAME}PythonD ${c}PythonD)</div><div>ENDFOREACH(c)</div><div><br></div><div>TARGET_LINK_LIBRARIES(${LIB_NAME}Python ${LIB_NAME}PythonD)</div></blockquote></div><div style="font-size:12.8px"><div><br></div><div>As I said before, this all builds without error but when I try to run any python script that includes the library I get the following error:</div></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><br></div><div>ImportError: dynamic module does not define init function</div></div><div><br></div></blockquote><span style="font-size:12.8px">Is there something I need to add to ensure that the init function is created?</span><br clear="all"><div><br></div>-- <br><div><div dir="ltr">Schuyler Kylstra</div></div>
</div></div>