Am Wed, 02 Feb 2005 13:55:24 +0100 schrieb Stefan Behnel: > Hi! > > I'm writing a parser using pyparsing and I would like to augment the > ParserException tracebacks with information about the actual error line *in > the parsed text*. Pyparsing provides me with everything I need (parsed line > and column), but is there a way to push that information on the traceback?
Hi, have a look at the source of ParseException. I guess there is attribute which holds the string. If the attribute is "msg", you could do it like this: try: .... except ParseException, e: e.msg="Textbefore %s" % e.msg raise e (code is not tested) Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.python.org/mailman/listinfo/python-list