changed exception handling in python example

This commit is contained in:
Enrico Fucile 2015-03-23 08:45:18 +00:00
parent 7d6c1a7072
commit cc35c36b78
1 changed files with 5 additions and 2 deletions

View File

@ -59,8 +59,11 @@ def example():
# print the values for the selected keys from the message
for key in keys:
if not codes_is_defined(gid,key): raise Exception("Key: " + key + " was not defined")
print ' %s: %s' % (key,codes_get(gid,key))
try:
print ' %s: %s' % (key,codes_get(gid,key))
except CodesInternalError,err:
print 'Error with key="%s" : %s' % (key,err.msg)
print err
cnt+=1