print stacktrace before variable dump in case the process crashes while creating variable dump

This commit is contained in:
Darren Ranalli 2008-09-05 20:46:09 +00:00
parent 36b6f93353
commit 7583ac4861

View File

@ -4,6 +4,7 @@ from direct.showbase.PythonUtil import fastRepr
from exceptions import Exception from exceptions import Exception
import sys import sys
import types import types
import traceback
notify = directNotify.newCategory("ExceptionVarDump") notify = directNotify.newCategory("ExceptionVarDump")
@ -69,6 +70,11 @@ class _AttrNotFound:
pass pass
def _excepthookDumpVars(eType, eValue, tb): def _excepthookDumpVars(eType, eValue, tb):
excStrs = traceback.format_exception(eType, eValue, tb)
s = 'printing traceback in case variable repr crashes the process...\n'
for excStr in excStrs:
s += excStr
notify.info(s)
s = 'DUMPING STACK FRAME VARIABLES' s = 'DUMPING STACK FRAME VARIABLES'
origTb = tb origTb = tb
#import pdb;pdb.set_trace() #import pdb;pdb.set_trace()