Fix for python 2.6 (trivial)

Change-Id: I206f7502a5f1f4de979ab8c2b13c63d83c49ad7c
Fix unbound var in exception path (trivial)

Change-Id: I71b98aa9def5037ba58b1682db3450e260a766cc