execfile error exception line number?
Brian Blais
bblais at bryant.edu
Thu Feb 23 14:05:36 EST 2006
Hello,
I'd like to do the following:
import sys
try:
execfile("somefile.py")
except:
s=sys.exc_info()
print "Error '%s' happened on line %d" % (s[1],s[2].tb_lineno)
(I'm going to replace the print later with a gui dialog)
how can I get the line number in "somefile.py" where the error occurs? When I do the
above, I get the line number in the script which calls execfile instead.
thanks,
Brian Blais
--
-----------------
bblais at bryant.edu
http://web.bryant.edu/~bblais
More information about the Python-list
mailing list