Modernize 'except' clauses

The 'as' syntax works from Python 2 on, and Python 3 will
drop the "comma" syntax.

Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
Petr Viktorin
2015-07-30 16:49:29 +02:00
committed by Tomas Babej
parent a651be3eec
commit 27dabb4528
118 changed files with 661 additions and 661 deletions

View File

@@ -1283,7 +1283,7 @@ class cli(backend.Executioner):
f = open(fname, 'r')
raw = f.read()
f.close()
except IOError, e:
except IOError as e:
raise ValidationError(
name=to_cli(p.cli_name),
error='%s: %s:' % (fname, e[1])
@@ -1291,7 +1291,7 @@ class cli(backend.Executioner):
elif p.stdin_if_missing:
try:
raw = sys.stdin.read()
except IOError, e:
except IOError as e:
raise ValidationError(
name=to_cli(p.cli_name), error=e[1]
)
@@ -1341,9 +1341,9 @@ def run(api):
except KeyboardInterrupt:
print ''
api.log.info('operation aborted')
except PublicError, e:
except PublicError as e:
error = e
except StandardError, e:
except StandardError as e:
api.log.exception('%s: %s', e.__class__.__name__, str(e))
error = InternalError()
if error is not None: