With c# in the Visual Studio IDE I can pause at anytime a program and watch its variables, inspect whatever I want. I noticed that with the Komodo IDE when something crashes
If you put
import code
code.interact(local=locals())
in your program, then you will be dumped to a python interpreter. (See Method to peek at a Python program running right now)
This is a little different than pausing Komodo, but perhaps you can use it to achieve the same goal.
Pressing Ctrl-d exits the python interpreter and allows your program to resume.
You can inspect the call stack using the traceback module:
import traceback
traceback.extract_stack()
For example, here is a decorator which prints the call stack:
def print_trace(func):
'''This decorator prints the call stack
'''
def wrapper(*args,**kwargs):
stacks=traceback.extract_stack()
print('\n'.join(
[' '*i+'%s %s:%s'%(text,line_number,filename)
for i,(filename,line_number,function_name,text) in enumerate(stacks)]))
res = func(*args,**kwargs)
return res
return wrapper
Use it like this:
@print_trace
def f():
pass