7 Mar
2008
7 Mar
'08
6:17 p.m.
Robert Dailey wrote:
Hi,
Right now when an exception occurs in boost.python, I simply call PyErr_Print() to print the message to a console window. However, I would like to be able to have the option of redirecting the output of PyErr_Print() to a string, file, or any other ostream interface compatible object I choose. Is there an easy way to do this (possibly using boost)? My searching on the internet has not really shown any useful results. The answers I've seen involve creating pipes, which I don't want to do because it is non trivial. I was hoping boost could shine in this area since it seems to be a common issue.
Why don't you redirect sys.stderr from python?