From 2f013887c20310c522f9494ed854554e6f8c7aa4 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 7 Jun 2013 15:50:39 +0200 Subject: Use Python 3.x compatible except construct Per (proposed) Hacking H203 check, always use the except x as y: construct, which works with any Python version >= 2.6, including Python 3.x. Change-Id: I46028647d5a2a53ba8e9ce4d2e8fc6e71850fdae --- openstack/common/config/generator.py | 2 +- openstack/common/processutils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'openstack') diff --git a/openstack/common/config/generator.py b/openstack/common/config/generator.py index 4251c87..3f66f74 100755 --- a/openstack/common/config/generator.py +++ b/openstack/common/config/generator.py @@ -207,7 +207,7 @@ def _print_opt(opt): opt_type = None try: opt_type = OPTION_REGEX.search(str(type(opt))).group(0) - except (ValueError, AttributeError), err: + except (ValueError, AttributeError) as err: sys.stderr.write("%s\n" % str(err)) sys.exit(1) opt_help += ' (' + OPT_TYPES[opt_type] + ')' diff --git a/openstack/common/processutils.py b/openstack/common/processutils.py index 1aa1335..02cfada 100644 --- a/openstack/common/processutils.py +++ b/openstack/common/processutils.py @@ -203,7 +203,7 @@ def trycmd(*args, **kwargs): try: out, err = execute(*args, **kwargs) failed = False - except ProcessExecutionError, exn: + except ProcessExecutionError as exn: out, err = '', str(exn) failed = True -- cgit