Use os.errno constant instead of plain integer for checking error type