fix ImportError on Python 2.4

Python 2.4 doesn't have subprocess.CalledProcessError
Improve Python 2.4 compatibility
also catch OSErrors
Merge pull request #8 from ravishi/master

Fix ImportError on Python 2.4.