Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I trace all the functions/methods executing in a python script?

Is there a way to programmatically trace the execution of all python functions/methods? I would like to see what arguments each of them was called with. I really mean all, I'm not interested in a trace decorator.

In Ruby, I could alias the method I wanted and add the extra behaviour there.

like image 622
Geo Avatar asked Feb 03 '23 10:02

Geo


1 Answers

Have a look at the trace module.

You can also use it via the command line:

python -m trace --help
like image 129
jamesls Avatar answered Feb 06 '23 15:02

jamesls