Get last function's call arguments from traceback?

后端 未结 3 1497
滥情空心
滥情空心 2021-01-07 04:50

Can I get the parameters of the last function called in traceback? How?

I want to make a catcher for standard errors to make readable code, yet provide detailed info

3条回答
  •  再見小時候
    2021-01-07 05:42

    For such inspection tasks, always think first of module inspect in the standard library. Here, inspect.getargvalues gives you the argument values given a frame, and inspect.getinnerframes gives you the frames of interest from a traceback object.

提交回复
热议问题