Don't index exceptions directly

In Python 3, exceptions don't behave as tuples of their arguments;
instead of e[1] it's necessary to use e.args[1].

https://fedorahosted.org/freeipa/ticket/5623

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Viktorin
2016-01-05 13:36:15 +01:00
committed by Jan Cholasta
parent 126d899321
commit 465dd9829c
2 changed files with 4 additions and 4 deletions

View File

@@ -1284,14 +1284,14 @@ class cli(backend.Executioner):
except IOError as e:
raise ValidationError(
name=to_cli(p.cli_name),
error='%s: %s:' % (fname, e[1])
error='%s: %s:' % (fname, e.args[1])
)
elif p.stdin_if_missing:
try:
raw = sys.stdin.read()
except IOError as e:
raise ValidationError(
name=to_cli(p.cli_name), error=e[1]
name=to_cli(p.cli_name), error=e.args[1]
)
if raw: