From f0023610e844d006bd54709177027618632e3ecf Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Thu, 2 Jun 2016 18:49:22 +0200 Subject: [PATCH] Fix bin/ansible to not make a double traceback on python3 (#15972) --- bin/ansible | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/ansible b/bin/ansible index 59b4fec3051..58b4b1bf86a 100755 --- a/bin/ansible +++ b/bin/ansible @@ -82,7 +82,12 @@ if __name__ == '__main__': else: raise AnsibleError("Unknown Ansible alias: %s" % me) except ImportError as e: - if e.message.endswith(' %s' % sub): + # ImportError members have changed in py3 + if 'msg' in dir(e): + msg = e.msg + else: + msg = e.message + if msg.endswith(' %s' % sub): raise AnsibleError("Ansible sub-program not implemented: %s" % me) else: raise