1

Thank you for see this topic. I tried to use boost.python but now this error happens.

ImportError: dynamic module does not define init function (initlatticepy)

I checked some questions in web and some answers said that BOOST_PYTHON_MODULE name and filename must be the same. (ex. this page said) But I have already done it.

This is my code lattice.h,

BOOST_PYTHON_MODULE(latticepy)
{
  using namespace boost::python;
  class_<lattice::Lattice>("Lattice")
    .def("loadProperties", &lattice::Lattice::loadProperties)
    .def("train", &lattice::Lattice::train)
    .def_readonly("hmm_", &lattice::Lattice::hmm_);
}

and build code.

g++ -I`python -c 'from distutils.sysconfig import *; print get_python_inc()'` -DPIC -shared -fPIC -o latticepy.so lattice.h -g -O0 -lfst -ldl -lboost_system -lboost_python -std=c++11 -lpython2.7
Aqueous Carlos
  • 445
  • 7
  • 20
reoa
  • 11
  • 3

0 Answers0