Print A Stack Trace

import traceback; traceback.print_stack()

Using The Python Debugger pdb

set a breakpoint
import pdb; pdb.set_trace()