Python Forum
Tracing function calls - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Tracing function calls (/thread-628.html)



Tracing function calls - PyRaider - Oct-25-2016

I am new python but consider myself little more than a beginner. I am working on somebody else's code and its a huge program. I want to understand how the program flows, like what functions are called and what are the object status at that time. I want to build a visual representation of the flow if possible. Tried below things but with little success.
1. I tried using the trace module with command-line but that throws calls to all function including the libraries I imported. I tried the ignore-dir/module but that doesn't seem to work. 
2. I also tried using the Trace function in code with output in a file (dat or txt), but that doesn't output the function call relationship. 
3. Another thing I tried is the event handling but that seems to work only when the function calls are within the same file.

What do programmers usually use to trace function calls, when the program is huge and is dealing with large dataset calculation? Is there a tool or some functionality with any IDE that would be helpful?

Note: I am using 2.7 in PyCharm and Sublime Text 3.


RE: Tracing function calls - Larz60+ - Oct-25-2016

One thing you can do that may help some.

Load the code into python from a command line: python ProgramName.py
once loaded, at the prompt type: help('ProgramName')
you should get a help listing with attributes, classes, methods, functions, etc

You can save this to a file see post: class that Redirects text from stdio to file

[url=http://python-forum.io/Thread-class-that-Redirects-text-from-stdio-to-file][/url]