[C++-sig] import extension module in python on OSX

Simon W simwarg at gmail.com
Tue Sep 10 14:37:39 CEST 2013


Hello,

I've compiled the example code for Boost.Python:

#include <boost/python.hpp>

char const* greet()

{

    return "hello, world";

}

BOOST_PYTHON_MODULE(hello_ext)

{

    using namespace boost::python;

    def("greet", greet);

}


It compiles and I got an BoostPythonTest.dylib produced by Xcode. I've
tried to put that file in my site-packages folder and som other places in
order to import it into the interpreter like:

import BoostPythonTest

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ImportError: No module named 'BoostPythonTest'

>>>
I've tried to rename it to BoostPythonTest.so and .pyd and so on: But it
doesn't work. What is the proper extension name for boost python modules on
OSX? I'm using boost 1.53, OSX 1.8 and Python 3.2

Thanks in advance,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20130910/d8dc05cc/attachment.html>


More information about the Cplusplus-sig mailing list