[C++-sig] Re: Exception second time loaded

David Abrahams dave at boost-consulting.com
Fri Jun 20 13:57:26 CEST 2003


Kirsebom Nikolai <nikolai.kirsebom at siemens.no> writes:

> I have defined the PyExecutor class, CString<-->python string converter (see
> entry from Ralf W. Grosse-Kunstleve 27th May),
> code shown below.
> The function "RunPythonViaBoost" is called from the startup function of a
> DLL, loaded by the actual application.
>
> If I make use of the 'getit' function, the system runs into an exception the
> second time it is started.  The statement in RunStmt method
> being executed when the exception occurs is the second statement
> (PyRun_String).
>
> The stack-frame in the debugger is:
>
> boost_python_debug.dll!boost::python::throw_error_alread_set() Line 58
> DLEPRPythonDLd.dll!boost::python::expect_non_null(_object * x=0x00000000)
> Line 45 + 0x8
> DLEPRPythonDLd.dll!boost::python::detail::manage_ptr(_object * p=0x00000000,
> ...) Line 57 + 0x9
> DLEPRPythonDLd.dll!boost::python::handle<_object>::handle<_object>(_object *
> p=0x00000000) Line 80 + 0x30
> DLEPRPythonDLd.dll!PyExecutor::RunStmt(DLEPRInterface * dlepr=0x008be388)
> Line 336 + 0x31

PyRunString returned 0, meaning there was an exception raised in
Python code somewhere.  You should allow the exception to propagate so
that Python can report the error; that's where all the information is.
See the main() function in libs/python/test/embedding.cpp for how this
can be handled.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list