Expose exception objects via the as keyword

According to Python 3 Porting guide
http://docs.pythonsprints.com/python3_porting/py-porting.html

Exceptions were changed in a few ways for Python 3. First, strings
are no longer usable as exceptions. Additionally, the raise syntax no
longer accepts comma-separated arguments, instead working with exception
instances. Perhaps the largest difference in Python 3 is that exception
objects are only available via the as keyword, which was introduced in
2.6.

Change-Id: Ide665ecc4b7f14bd58bafab47e05a86a4cf2d141
Closes-Bug: #1490526
This commit is contained in:
Hengqing Hu 2015-08-31 15:58:13 +08:00
parent 3f5b601303
commit 1dab839de4

View File

@ -87,7 +87,7 @@ def main():
config.write(f)
module.exit_json(changed=changed)
except Exception, e:
except Exception as e:
module.exit_json(failed=True, changed=changed, msg=repr(e))