Boost.Python C++/PyRosetta interop

Member Site Forums PyRosetta PyRosetta – General Boost.Python C++/PyRosetta interop

Viewing 1 reply thread
  • Author
    Posts
    • #681
      Anonymous

        Hi,

        I’m writing a C++ library which I want to optionally export for use in Python using Py++.

        Is there an easy way to convert Python objects back to their original c++ counterparts?

        i.e.

        void setPosePython(boost : : python : : object pose)

        {

        setPose(boost : : python : : extract <core : : pose : : Pose & >(pose));

        }

        Thanks!

      • #4645
        Anonymous

          Looks like this was due to a boost incompatibility.

          PyRosetta includes a version of boost_python in the rosetta dir.
          Relinking this to your system version of boost_python should do the trick.

          In my case:

          mv ./libboost_python-mt-py26.so.1.38.0 libboost_python-mt-py26.old &&
          ln -sf /usr/lib/libboost_python-mt-py26.so libboost_python-mt-py26.so.1.38.0

          This insures that conversion and extraction is properly registered globally.

          The above code is no longer necessary, just use:

          void setPosePython(core : : pose : : Pose &p)
          {

          }

          directly.

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.