From f1f059b05efbb4f31be4d82f93e1e901cf68b239 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Tue, 13 Feb 2018 21:07:36 -0800 Subject: constants: fix pylint warnings for OSError IOError and OSError are the same in Python 3? Anyway we want to ignore ENOENT, not EEXIST JIRA: YARDSTICK-1012 Change-Id: Ia75e41fecce505685745e0099669e45f3e82a1be Signed-off-by: Ross Brattain --- yardstick/common/constants.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index 32ed746df..646a1f2ca 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -7,9 +7,9 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## from __future__ import absolute_import -import os -import errno +import errno +import os from functools import reduce import pkg_resources @@ -40,10 +40,8 @@ def get_param(key, default=''): try: with open(conf_file) as f: value = yaml_load(f) - except IOError: - pass - except OSError as e: - if e.errno != errno.EEXIST: + except (IOError, OSError) as e: + if e.errno != errno.ENOENT: raise else: CONF.update(value) -- cgit 1.2.3-korg