Do a Simple Python Error Check (with pyflakes) Every Time You Save in Textmate

21 Nov 2009

The other day I was experimenting with pyflakes and because it was quite fast (though not comprehensive), I decided to add a little hook as a Textmate command to do a pyflakes validation every time I saved a python file.

pyflakes in Textmate example[/caption]

As you can see in the example pictured, pyflakes catches simple things like missing imports, unused imports, and undefined local variables.

Although there is already a python bundle for Textmate to Validate Syntax (PyCheckMate), I found the HTML output in a separate window a little to disruptive to be used on every save, so I just use pyCheckMate occasionally as needed.

To use set this up, first do:

sudo easy_install pyflakes

Then, download and install this Textmate Command: Validate Syntax with pyflakes on Save Textmate Command.