From 4a03707c3e65e0a04c800c8c61fa2514b223a0da Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 4 Nov 2016 11:04:36 -0400 Subject: [PATCH] Make error handling around already existing directories more precise (#71) --- infra/helper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infra/helper.py b/infra/helper.py index 339fb3196..b6f59e4b1 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -17,6 +17,7 @@ from __future__ import print_function import argparse +import errno import os import pipes import re @@ -236,7 +237,9 @@ def generate(generate_args): try: os.mkdir(dir) - except OSError: + except OSError as e: + if e.errno != errno.EEXIST: + raise print(dir, 'already exists.', file=sys.stderr) return 1