Some help with error messages

James Ervin <[email protected]> Tue, 16 Aug 2016 14:15:41 -0500
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAPzghv-YpGfHgRkZuCnDeKPxbSyuVffqUtrr3ea6LYYnBbUP7A@mail.gmail.com>
I was wondering if someone could point me to either the jython class or a
document where the format of error messages is defined.

I am working on embedding a jython engine inside an Eclipse RCP
application.  I would really love to be able to extract line numbers (if
not exact character offsets) from errors generated by bad python code.

For example I get:
SyntaxError: ("no viable alternative at input 'crap'", ('<string>', 5, 11,
'    crappy crap crap\n'))

I am trying to figure out how to successfully extract the 5 and 11 there.

Another example:
Traceback (most recent call last):File "<string>", line 1, in
<module>AttributeError: 'NoneType' object has no attribute 'getName'

Obviously the line followed by the number should be sufficient.

Also is there a better way to get these errors than catch exceptions from
PythonInterpreter.exec()?

Thanks,
James E. Ervin, IV

"Noli nothis permittere te terere."
"Romanes eunt domus."
Blog: http://iacobus.blogspot.com

------------------------------------------------------------------------------

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users