Do not use locals() for string formatting (H501)

Fixes a warning triggered by Hacking 0.7.x or newer. There
is no need to use a positional string formatting here, since
this is not going to be localized.

Change-Id: Ie38d620aecb0b48cd113af45cc9ca0d61f8f8ff1
Use Python 3.x compatible except construct

except x,y: was deprected and is removed in Python 3.x.
Use "except x as y:" instead which works in any Python
version >= 2.6.

Change-Id: I7008c74b807340f3457d3a0c8bd0b83f23169d14
Merge "Do not use locals() for string formatting (H501)"
Merge "Use Python 3.x compatible except construct"