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

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.