Any easy way to get more RE-friendly error messages from Python?

Kenneth McDonald kenneth.m.mcdonald at
Wed Jun 16 00:31:16 CEST 2004

I'm setting myself up to use Python with jEdit (after trying
jed, VIM, others...urggh.) One small problem I'm having is
that while jEdit has a nice plugin called Console which can
be set up to run python scripts, and parse the result for
errors which can then be used to put the editing cursor
directly on the offending line, it doesn't play so well with
the multiline error messages that Python generates. (Actually,
I've never liked them a lot myself :-) ) The easiest way
to deal with this is probably to hack Python to put out
its error messages in a different format: I can think of
a couple of approaches, but they seem a little kludgey,
so I thought I'd solicit suggestions from the group.

So instead of error output that looks like this:

Traceback (most recent call last):
  File "", line 75, in ?
    DNOTE('''This documentation was writting using the 'doco' module.'''),
NameError: name 'DNOTE' is not defined

I'd prefer something like: name 'DNOTE' is not defined

(with, obviously, one such line for each element of the traceback.)

The thoughts that come to me first are:

1) Write some sort of wrapper to python.
2) Find and change an internal python hook.

I'm wondering what other ways of approaching this might
be suggested--both of the above have certain elements
I dislike.


More information about the Python-list mailing list