import sys
try :
... ...
except Exception as inst :
s=sys.exc_info()
raise AssertionError("%s->%s: Failed to capture td log,line:%s exception:%s" \
% (__name__,keyword_name,s[2].tb_lineno,inst))
s = sys.exc_info()
print "Error '%s' happened on line %d" % (s[1],s[2].tb_lineno)