diff --git a/lib/ansible/modules/cloud/amazon/iam_policy.py b/lib/ansible/modules/cloud/amazon/iam_policy.py index 1b53790559..87f32c9838 100644 --- a/lib/ansible/modules/cloud/amazon/iam_policy.py +++ b/lib/ansible/modules/cloud/amazon/iam_policy.py @@ -301,7 +301,7 @@ def main(): with open(policy_document, 'r') as json_data: pdoc = json.dumps(json.load(json_data)) json_data.close() - except IOError: + except IOError as e: if e.errno == 2: module.fail_json( msg='policy_document {0:!r} does not exist'.format(policy_document))