- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
def err_report():
if sys.exc_info() != (None,None,None) :
last_type, last_value, last_traceback = sys.exc_info()
else :
last_type, last_value, last_traceback = sys.last_type, sys.last_value, sys.last_traceback
tb, descript = last_traceback, []
while tb :
fname, lno = tb.tb_frame.f_code.co_filename, tb.tb_lineno
descript.append('\tfile "%s", line %s, in %s\n'%(fname, lno, tb.tb_frame.f_code.co_name))
tb = tb.tb_next
descript.append('%s : %s\n'%(last_type.__name__, last_value))
for i in descript :
sys.stderr.write(i),
if __name__ == "__main__":
def test():
""" for test itself """
try:
pass
""" HERE YOUR CODE """
except Exception:
err_report()
return 2
sys.exit(test())
Комментарии (0) RSS
Добавить комментарий