可以从代码中将 IPDB/Celery-RDB 堆栈跟踪 ('where') 打印到标准输出吗?

Possible to print the IPDB/Celery-RDB stack trace ('where') to stdout from within the code?

在 IPDB 或 RDB 中输入 'w(here)' 将打印出堆栈跟踪。

有没有不用输入 set_trace() 就可以做到这一点的方法?

我猜我想像的是 print(w),或者只是在 set_trace() 处打印堆栈跟踪。

traceback.print_stack() 是您想要的,它将打印从 sys._getframe() 开始的当前调用堆栈,更多信息请参见 its doc