How to extract complete file path from traceback info

Thomas Guettler guettli at thomas-guettler.de
Mon Jun 21 10:27:59 EDT 2004


Am Fri, 18 Jun 2004 21:31:03 +0000 schrieb Kenneth McDonald:

> I have a need to customize the output of Python error tracebacks,
> and to that end I've implemented my own sys.excepthook function.
> However, one remaining problem that I'm having is the information
> passed to this function doesn't seem to have the _full_ path name
> of the file in which the exception occurred. I need this because
> the output is being parsed by an editor (jEdit) which uses this
> information to set up links to errors origins in the source
> code.
> 
> Is there an easy way to get this info somehow? (I haven't been
> able to find it.) I can think of some 'solutions' I'd prefer
> not to attempt unless I have to.

Hi Kenneth,

AFAIK, the module cgitb does this. Take a look at it.

HTH,
 Thomas



More information about the Python-list mailing list