[Geany-devel] Python message parsing (bug 3411489)

Enrico Tröger enrico.troeger at xxxxx
Tue Oct 18 21:59:40 UTC 2011


On Tue, 18 Oct 2011 20:48:12 +1100, Lex wrote:

>It appears that Python error message formatting has changed from what
>is used in msgwin.c/parse_compiler_error_line()
>
>I havn't found anything in the Python docs or google that describes
>what it should be, does anyone have more knowledge so we can set a
>regex?

In Python 2.6 they introduced the doraise keyword argument to
py_compile.compile. Until then, always a stacktrace was printed and
Geany's builtin parsing matched one of the lines of the stacktrace.

Since Python 2.6, only an error message line is printed and so the
builtin code fails.

Example (from an embedded device which luckily has Python 2.5 and 2.6
installed :D):

[21:37] root at kalki (0): ~# python2.5 -t -c "import py_compile;
py_compile.compile('/tmp/test.py')" File "/tmp/test.py", line 5
    df lala(la):
          ^
SyntaxError: invalid syntax



[21:37] root at kalki (0): ~# python2.6 -t -c "import py_compile;
py_compile.compile('/tmp/test.py')" SyntaxError: ('invalid syntax',
('/tmp/test.py', 5, 7, 'df lala(la):\n'))


This should be fixed in GIT master. However, I only tested it against
SyntaxErrors.

Good catch, Lex. I never noticed it as I almost always use pylint
with a regex for Python code checking :).

And if someone still has a regex for the Python 2.6+ format, feel free
to share it. It might help users with older versions of Geany.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20111018/34e142b2/attachment.pgp>


More information about the Devel mailing list