Catching IOError instead of integers and checking the errno on the IOError for the same error codes
Merge pull request #16 from premal/master

Exception was catching error codes instead of an exception class