0
$\begingroup$

Rosanswers logo

Hey, I was trying to write a Python C++ wrapper as described in the Tutorial: "Using a C++ class in Python".

Now to my question, is there a way to compile the Module for Python 2.7 and 3 simultaneously using catkin? So i can import the wrapper Class in both versions?

Because currently when Importing the wrapper to python 3 this error is thrown: ImportError: dynamic module does not define module export function (PyInit__wrapper_cpp) Since i can only link it against the python 2 libs.

Under Python 2 it is currently working without any errors.

Thanks for your help, Thomas


Originally posted by Thomas_Blo on ROS Answers with karma: 11 on 2017-07-28

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It's doable, but pretty disgusting (macros/pragmas are very involved, due to major difference in the wrapper API). I wouldn't bother with the python 2/3 backwards compatibility, just stick with 3 if you wrote it in 3. Mixing python versions in ROS gets messy very quickly.


Originally posted by allenh1 with karma: 3055 on 2017-07-30

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.