From d3d1868021257c983cc86ba9e55fb3f059d340ac Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Thu, 27 Dec 2018 11:07:39 -0500 Subject: [PATCH] Fix IOError on cleanup when git not found 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 --- cleanup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cleanup.py b/cleanup.py index 7e693b3a..469707ee 100644 --- a/cleanup.py +++ b/cleanup.py @@ -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 @@ -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