Skip to content

Commit

Permalink
Fix IOError on cleanup when git not found
Browse files Browse the repository at this point in the history
On posix systems IOError is raised when git is not found

In Python 3 IOError is an alias for OSError.
In Python 2 IOError is not caught by OSError so we must catch both.

Fixes #1460
  • Loading branch information
labrys committed Dec 27, 2018
1 parent da2c758 commit d3d1868
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def clean_bytecode():
print(result)
except subprocess.CalledProcessError as error:
sys.exit('Error Code: {}'.format(error.returncode))
except OSError as error:
except (IOError, OSError) as error:
sys.exit('Error: {}'.format(error))
else:
return result
Expand All @@ -70,7 +70,7 @@ def clean_folders(*paths):
)
except subprocess.CalledProcessError as error:
sys.exit('Error Code: {}'.format(error.returncode))
except OSError as error:
except (IOError, OSError) as error:
sys.exit('Error: {}'.format(error))
else:
return result
Expand Down

0 comments on commit d3d1868

Please sign in to comment.