11

Do you know an integrated tool that will generate the call graph of a function from Python sources? I need one that is consistent and can run on Windows OS.

ire_and_curses
  • 68,372
  • 23
  • 116
  • 141
citn
  • 1,522
  • 3
  • 18
  • 29

3 Answers3

10

You could try with PyCallGraph
From its documentation:

Python Call Graph works with Linux, Windows and Mac OS X.

Otherwise, you can directly do it on your own, using the traceback module:

import traceback
traceback.print_stack()
rob
  • 36,896
  • 2
  • 55
  • 65
9

PyCallGraph produces the dynamic graph resulting from the specific execution of a Python program and not the static graph extracted from the source code. Does anybody know of a tool which produces the static graph?

Asclepius
  • 57,944
  • 17
  • 167
  • 143
Tsf
  • 1,339
  • 5
  • 17
  • 29
6

What about pycallgraph, it's a Python module that creates call graphs for Python programs. It works on windows. Just download graphviz and pycallgraph, pycallgraphs's source tarball has some examples.
Hope this helps

sunqiang
  • 6,422
  • 1
  • 32
  • 32