Created
October 17, 2013 07:41
-
-
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).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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