Your browser is very old. You might enjoy surfing the web more if you used something newer like:

Google Chrome

Even Firefox would be OK.

If you're being forced at gunpoint to use Internet Explorer, you should at least upgrade it. Version 8 is tolerable and 9 will be OK when it comes out.

Posts from March 2010

One-liner to syntax check a Python script

It’s always bothered me that PHP has php -l to do a quick syntax check of a file and there wasn’t an equivalent in Python.

And then I came across this gem of a one-liner:

python -c "compile(open('myapp.py').read(), 'myapp.py', 'exec')"

Just change myapp.py to the name of your script and off you go.

Here’s a little Bash script that make it easier to use:

#!/bin/bash

if [ -f $1 ]
then
    python -c "compile(open('$1').read(), '$1', 'exec')"
else
    echo "The file $1 was not found."
    exit 1
fi

exit 0