PyErr_Print() but not to stderr?
Mike Romberg
romberg at smew.fsl.noaa.gov
Wed May 19 19:34:33 EDT 1999
Does anyone know if it is possible to redirect where the output of
PyErr_Print() is sent? I have an embeded python process which is
running as a daemon and has shut down stdin, stderr and stdout. So,
when a python error occurs I can detect it but can find an easy way to
redirect the output of PyErr_Print() or PyErr_PrintEx() to a logfile.
It occurs to me that I might reopen the stderr file descriptor and
FILE object onto my file to do this. This seems a bit ugly. Perhaps
there is another method. I did take a quick look at the definition of
PyErr_PrintEx() in the 1.5.2 release. It looks a bit too involved for
me to just place a modified version in my program. Perhaps there is
some better method I am missing?
Thanks,
Mike Romberg (romberg at fsl.noaa.gov)
More information about the Python-list
mailing list