Portable exception to avoid syntax error message

Bug #1490526 reported by Hengqing Hu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Fix Released
Low
Hengqing Hu

Bug Description

Every time I open ansible/library/merge_configs.py, I got the following error:
ansible/library/merge_configs.py|90 col 21 error| invalid syntax

Checking other files, they all use 'as' keyword for exception:
grep -r "except.*as.*" *
docker/kolla-ansible/kolla_keystone_user.py: except Exception as e:
docker/kolla-ansible/kolla_keystone_service.py: except Exception as e:

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.

Hengqing Hu (hudayou)
Changed in kolla:
assignee: nobody → Hengqing Hu (hudayou)
Steven Dake (sdake)
Changed in kolla:
status: New → Triaged
importance: Undecided → Low
milestone: none → liberty-3
Changed in kolla:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla (master)

Reviewed: https://review.openstack.org/218757
Committed: https://git.openstack.org/cgit/stackforge/kolla/commit/?id=1dab839de49be7ef92f274416b417b2007c1d9bd
Submitter: Jenkins
Branch: master

commit 1dab839de49be7ef92f274416b417b2007c1d9bd
Author: Hengqing Hu <email address hidden>
Date: Mon Aug 31 15:58:13 2015 +0800

    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

Changed in kolla:
status: In Progress → Fix Committed
Sam Yaple (s8m)
Changed in kolla:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.