traceback#

class traceback(exc=None, value=None, tb=None, *args, **kwargs)[source]#

Shortcut for accessing the traceback

Alias for traceback.format_exc().

If no argument

Examples:

# Use automatic exception info
mylist = [0,1]
try:
    mylist[2]
except:
    print(f'Error: {sc.traceback()}')

# Supply exception manually (also illustrating sc.tryexcept())
with sc.tryexcept() as te1:
    dict(a=3)['b']

with sc.tryexcept() as te2:
    [0,1][2]

tb1 = sc.traceback(te1.exception)
tb2 = sc.traceback(te2.exception)
print(f'Tracebacks were:

{tb1} {tb2}’)