Skip to content

Instantly share code, notes, and snippets.

@alexgarel
Created October 17, 2013 07:41
Show Gist options
  • Save alexgarel/7020722 to your computer and use it in GitHub Desktop.
Save alexgarel/7020722 to your computer and use it in GitHub Desktop.
Using Geany and launching pyflakes or pep8 ? This script parse pyflakes / pep8 output and add line filename and line numbers and produce an output suitable for Geany (underlining errors and jumping to related line as you cilck on ouput).
#!/usr/bin/env python3
"""
Geany pyflakes and pep8 output reformater
When defining your compile command in geany use::
/path/to/pyflakes %f 2>&1 |/path/to/pyflakes_out_for_geany.py
/path/to/pep8 %f |/path/to/pyflakes_out_for_geany.py
"""
import sys
import re
line_indic = re.compile(r"^(?P<fname>.*\.py):(?P<line>\d+):")
while True:
l = sys.stdin.readline()
if not l:
break
l = line_indic.sub(r'File "\g<fname>", line \g<line>, in <module>:', l)
print(l, end='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment