Original Post
Hey @all, can anybody explain me how to redirect the "PyErr_Print()" to boost::python or to a std::string or equivalent? My Problem is that I have a GUI Application, so i don't have a console window where a python error can be printed with "PyErr_Print()". I need to redirect the output of "PyErr_Print()" and show this message in a MessageBox like the following: I 've already tried the following: but with this i became the following error: I have the following installed .) Python 2.5.2 .) Boost 1_35_0 .) mingw32-make 3.80 Kind Regards NoRulez [Edited by - NoRulez on April 23, 2008 4:58:56 AM]
try {
.
.
.
}catch(AnyPythonERROR &e) {
// PyErr_Print(); // <------ This output must be shown in the MessageBox
MessageBox("HERE COMES THE PYTHON ERROR (BACKTRACE)");
}
catch (bp::error_already_set const&) {
bp::str blubb = bp::import("sys").attr("stderr").attr("data");
}
error: conversion from `boost::python::api::proxy<boost::python::api::attribute_policies>' to non-scalar type `boost::python::str' requested