James Ervin
2016-08-16 19:15:41 UTC
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
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