On 11/06/2012 02:40 PM, Cory Riddell wrote:
> It prints "hello\nworld\n" then throws an exception executing the line
> that creates the hello.txt file:
>   First-chance exception at 0x755ac41f in Test.exe: Microsoft C++
> exception: boost::python::error_already_set at memory location 0x0039fb60..
>   Unhandled exception at 0x773915de (ntdll.dll) in Test.exe: Microsoft
> C++ exception: boost::python::error_already_set at memory location
> 0x0039fb60..
>
> In the exec method, the exception is being thrown when result comes back
> as null:
>   PyObject* result = PyRun_String(s, Py_file_input, global.ptr(),
> local.ptr());
>   if (!result) throw_error_already_set();

I suggest you wrap your C++ code in a try block, then catch the
error_already_set error and inspect the Python exception using
PyErr_Print() or somesuch.

    Stefan


-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to