[C++-sig] Boost.Python Problem

Jim Bosch talljimbo at gmail.com
Wed May 26 06:28:54 CEST 2010


On 05/18/2010 12:44 PM, alexandre monti wrote:
> object main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));
> object main_namespace = main_module.attr("__dict__");

What's the context?  At least on my Ubuntu system, the following code:

#include <boost/python.hpp>

using namespace boost::python;

BOOST_PYTHON_MODULE(example) {
     object 
main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));
     object main_namespace = main_module.attr("__dict__");
}

...compiles and imports just fine.


Jim Bosch



More information about the Cplusplus-sig mailing list