Philippe C. Martin wrote:
Hi,
All of the methods from my program return None on error (i.e; I do not
want to assert and have the program exit).
Is it possible to print the current source file name/line number ?
ex: in C/C++ I would use the macros __FILE__ and __LINE__.
Consider something like this:
#!/usr/bin/env python
def main():
raise RuntimeError('whatever')
if __name__ == '__main__':
try:
main()
except:
import sys, traceback
t, v, tb = sys.exc_info()
traceback.print_tb(tb)
--
http://mail.python.org/mailman/listinfo/python-list