|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2008-03-13 17:23:15
on Wed Feb 20 2008, "Robert Dailey" <rcdailey-AT-gmail.com> wrote:
> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net