0

I am trying to automatically generate a list of function call in their call order for documentation purposes with something like

python - m trace --trackcalls main.py

however, running the trace module with my files seems to show ALL calls, including built-in modules, while I only need the trace for the source files written by me so that I can show the workflow of the program in the documentation. Is there any existing convenient way to only get the trace for specified source files or would I have no other choice but writing an additional script taking the raw trace output and filtering it?

Alex
  • 1
  • This same question and answer have already been provided [here](https://stackoverflow.com/a/32999522/2373382) – Matt Hatcher Jun 28 '22 at 13:50
  • 1
    Does this answer your question? [How to limit python traceback to specific files](https://stackoverflow.com/questions/31949760/how-to-limit-python-traceback-to-specific-files) – Matt Hatcher Jun 28 '22 at 13:50
  • Thanks for the link! Unfortunately, from what I see, the sys.excepthook is specifically for uncaught exceptions, no? In my case I want to trace a successful run with no exceptions to see the exact sequence of function calls throughout the run in the order in which they were called. Unless I'm missing something and sys.excepthook can somehow be adapted for this more general case? – Alex Jun 29 '22 at 14:19

0 Answers0