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

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

pyflakes in Textmate example

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.

Related posts:

  1. Install Python Enabled Vim on OS X
  2. How to Run External Commands Without Leaving Vim
  3. URL Escape Strings in Google Spreadsheets with a Simple Script
  4. How To Suppress DeprecationWarning in Python
  5. Reading About Twitter Scaling and Some Other Interesting Stuff
You should follow me on Twitter here.
Subscribe to labs via email here.

About this entry