On 05/31/2012 09:57 AM, Qi wrote:
Hi guys,

I have an application that embedding Python into C++.
When any exception occurred in C++ code, PyErr_SetString will
be called to propagate the exception to Python.

The problem is, some unit tests trigger exception on intention.
So it's OK to have the exceptions. But Python will still print
the exception to console, polluting the unit test output.

My question is, is there any way to disable exception reporting
to console from either C++ or Python code?



Did you try to reassign sys.stderr to '/dev/null/ or another file?

This works of course only if no other code wants to write to sys.stderr.



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to