Correctly catch IOError

except OSError, IOError does not catch IOError but will overwrite IOError with
catched exception. See [1] for detauls.

[1] http://docs.python.org/2/whatsnew/2.6.html#pep-3110-exception-handling-changes

Signed-off-by: Sebastian Ramacher <sramacher@debian.org>
Merge pull request #150 from sebastinas/except-shadows-builtin

Correctly catch IOError
PEP8 conformance fixes.