I have made a python wrapping of a c++ class similar to here and here. but the generated python wrapper is only usable in python2 while giving the following error in python3:
dynamic module does not define module export function (PyInit_...)
my setup.py looks like the following:
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['hw_interface_pkg'],
package_dir={'': 'src'},
requires=['std_msgs', 'rospy'],
language_level="3",
compiler_directives={'language_level' : "3"}
)
setup(**setup_args)
following this thread I tried adding language_level = "3"
or compiler_directives={'language_level' : "3"}
to the above setup_args but none solved the problem.
my pyx file also looks like:
cdef extern from "remote_hw.h":
cdef cppclass ROBOTHardwareInterface:
ROBOTHardwareInterface() except +
double c_fibonacci(double n);
cdef class PyHWInterface:
cdef ROBOTHardwareInterface c_obj
def __cinit__(self):
pass
def fibonnaci_func(self,n):
return self.c_obj.c_fibonacci(n)
-------------edit
I made sure setup.py is called by python3. but still the same issue.....