Embedding -- getting error/traceback information not to stderr?

Erwin S. Andreasen erw at dde.dk
Tue Jan 25 07:34:10 EST 2000


On Mon, 24 Jan 2000 18:05:26 -0000, Adrian Eyre <a.eyre at optichrome.com> wrote:

>> Did I miss some other similar function that will return the nicely
>> formatted exception information in a variable?
>>  1) copy PyErr_Print(), modify it to append to a file (yuck!)
>>  2) Modify sys.stderr to append to an internal buffer instead of a file

>3) Set stderr to be stdout

Well, I wanted the information to be in a variable in memory, which I can
then send to the user (which isn't looking at stdout :) ). I suppose I could
set sys.stderr to something like a file which I then open and read after
each use of PyErr_Print -- or a pipe the other end of which I watch -- but
that doesn't seem very... elegant.

-- 
==============================================================================
Erwin Andreasen   Herlev, Denmark <erw at dde.dk>          UNIX System Programmer
<URL:http://www.andreasen.org>              <*>              Goodbye, Richard!
==============================================================================



More information about the Python-list mailing list