Stefan Seefeld wrote:
You seem to be missing a call to
PyImport_AppendInittab("testing", inittesting);
before the call to PyRun_SimpleString.
Thanks, that indeed allows me to use stuff in the testing module. It is not quite what I was hoping for, as the Python code will come from a user-written file, and ideally I would like the Python code to be able to load arbitrary modules. However, the set of Boost.Python produced modules is fairly small, so in a pinch I can simply import all of them using PyImport_AppendInittab. A tad too brute force to my taste, but I can live with it.
(Also note that the soon-to-be boost 1.34 has an enhanced API for the above, boost::python::exec() and boost::python::exec_file().)
I'm looking forward for 1.34 to come out officially. -- Pertti