import inspect try: raise ValueError except: print inspect.trace()