All Samples(248) | Call(221) | Derive(0) | Import(27)
Format a list of traceback entry tuples for printing. Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strings may contain internal newlines as well, for those items whose source text line is not None.
def format_list(extracted_list):
"""Format a list of traceback entry tuples for printing.
Given a list of tuples as returned by extract_tb() or
extract_stack(), return a list of strings ready for printing.
Each string in the resulting list corresponds to the item with the
same index in the argument list. Each string ends in a newline;
the strings may contain internal newlines as well, for those items
whose source text line is not None.
"""
list = []
for filename, lineno, name, line in extracted_list:
item = ' File "%s", line %d, in %s\n' % (filename,lineno,name)
if line:
item = item + ' %s\n' % line.strip()
list.append(item)
return list
escape(filename),
lineno, escape(where)) )
except Exception, e:
tb = escape(''.join(traceback.format_list(traceback.extract_tb(sys.exc_info()[2]))))
raise CommandError('stack_get', tid, ERROR_EXCEPTION,
'Unknown exception %s\n%s' % (str(e), tb))
ret.append( itemProperty.toxml(0, self._max_children, self._max_data) )
except Exception, e:
tb = escape(''.join(traceback.format_list(traceback.extract_tb(sys.exc_info()[2]))))
raise CommandError('context_get', tid, ERROR_EXCEPTION,
'Unknown exception %s\n%s' % (str(e),tb))
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/code.py ironruby(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
list = traceback.format_list(tblist)
if list:
list.insert(0, "Traceback (most recent call last):\n")
list[len(list):] = traceback.format_exception_only(type, value)
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/code.py ironruby(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
list = traceback.format_list(tblist)
if list:
list.insert(0, "Traceback (most recent call last):\n")
list[len(list):] = traceback.format_exception_only(type, value)
src/j/y/jython-HEAD/sandbox/tobias/jython/CPythonLib/code.py jython(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
list = traceback.format_list(tblist)
if list:
list.insert(0, "Traceback (most recent call last):\n")
list[len(list):] = traceback.format_exception_only(type, value)
src/p/y/pymel-HEAD/maya/utils.py pymel(Download)
tbLines = []
tbLines.append("Error in maya.utils._guiExceptHook:\n")
tbLines += traceback.format_list( tbStack[1:] ) + traceback.format_exception_only(etype, value)
tbLines.append("\nOriginal exception was:\n")
tbLines += traceback.format_exception(exceptionType, exceptionObject, traceBack)
result = exceptionMsg
else: # detail == 2
# format the traceback stack
tbLines = _decodeStack( traceback.format_list(tbStack) )
if len(tbStack) > 0:
tbLines.insert(0, u'Traceback (most recent call last):\n')
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32comext/axscript/client/error.py ironruby(Download)
tb_top = tb bits = ['Traceback (most recent call last):\n'] bits.extend(traceback.format_list(format_items)) if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]:
src/j/y/jython-HEAD/jython/CPythonLib/code.py jython(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
list = traceback.format_list(tblist)
if list:
list.insert(0, "Traceback (most recent call last):\n")
list[len(list):] = traceback.format_exception_only(type, value)
src/p/y/pypy3-HEAD/lib-python/3.1.2/code.py pypy3(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
lines = traceback.format_list(tblist)
if lines:
lines.insert(0, "Traceback (most recent call last):\n")
lines.extend(traceback.format_exception_only(type, value))
src/p/y/pypy3-HEAD/lib-python/2.5.2/code.py pypy3(Download)
sys.last_traceback = tb
tblist = traceback.extract_tb(tb)
del tblist[:1]
list = traceback.format_list(tblist)
if list:
list.insert(0, "Traceback (most recent call last):\n")
list[len(list):] = traceback.format_exception_only(type, value)
src/m/o/modeling-HEAD/trunk/ProjectModeling/Modeling/scripts/mdl_generate_DB_schema.py modeling(Download)
def tracebackInfoFromStack(exc_traceback):
"""
"""
from traceback import extract_tb, format_list
from Modeling.utils import isListOrTuple
tb=None
str='%s\n%s\n'%sys.exc_info()[:2]
try:
tb=sys.exc_info()[-1]
str+=reduce(lambda a,b: a+b, format_list(extract_tb(tb)))
def databaseSchemaWithOptions(model,
options={},
administrativeConnectionDictionary={},
onlyStatements=0, continue_on_errors=0,
endStatementWith=';',
createUser=0, dropUser=0):
from traceback import format_list
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next