
on Wed Feb 20 2008, "Robert Dailey"
Hi,
When I execute the following code:
BEGIN CODE -------------------------------------------------- #define BOOST_PYTHON_DEF( func ) boost::python::def( #func, func )
using namespace boost::python;
static char const* PrintHelloWorld() { return "Hello World!"; }
BOOST_PYTHON_MODULE(Script) { BOOST_PYTHON_DEF( PrintHelloWorld ); }
void BeginPythonTest() { try { Py_Initialize();
initScript();
Py_Finalize(); }
catch( error_already_set const& /*err*/ ) { PyErr_Print(); }
catch( std::invalid_argument const& /*err*/ ) { PyErr_Print(); } } -------------------------------------------------- END CODE
I receive the following error message: Fatal Python error: Interpreter not initialized (version mismatch?)
a. Boost.Python is not compatible with Py_Finalize b. Even if it were, you can't make any calls to the Python API (like PyErr_Print) after Py_Finalize. You'll get better help from the C++-sig: http://boost.org/more/mailing_lists.htm#cplussig -- Dave Abrahams Boost Consulting http://boost-consulting.com