gak / pycallgraph

pycallgraph is a Python module that creates call graphs for Python programs.
GNU General Public License v2.0
1.82k stars 336 forks source link

Exception during profiling #145

Open rgom opened 9 years ago

rgom commented 9 years ago

I'm trying to profile some scapy library code. It's inside some script:

from scapy import all as scapy
scapy.arch.read_routes_orig()
scapy.arch.read_routes()

I'm executing this code from Python with no problems:

C:\temp\scapy-new\scapy-2.3.1>python C:\Users\rgomulk\workspace\Temporary_project\scapy_start_profile.py
WARNING: No route found for IPv6 destination :: (no default route?)
WARNING: can't import layer ipsec: 'module' object has no attribute 'IPPROTO_AH'

But when profiling it I get some exception:

C:\temp\scapy-new\scapy-2.3.1>python c:\Python27\Scripts\pycallgraph -v --max-depth=6 -i "scapy.arch.*" graphviz -l "c:\Program Files (x86)\Graphviz2.36\bin\dot.exe" -- C:\Users\rgomulk\workspace\Temporary_project\scapy_start_profile.py
WARNING: No route found for IPv6 destination :: (no default route?)
WARNING: can't import layer ipsec: 'module' object has no attribute 'IPPROTO_AH'
Executing: "c:\Program Files (x86)\Graphviz2.36\bin\dot.exe" -Tpng -opycallgraph.png c:\users\rgomulk\appdata\local\temp\tmpbjb0su
Generated pycallgraph.png with 18 nodes.
Traceback (most recent call last):
  File "c:\Python27\Scripts\pycallgraph", line 26, in <module>
    exec(__file_content)
  File "<string>", line 23, in <module>
AttributeError: 'module' object has no attribute 'read_routes_orig'

(Line numbers altered)

Why there's such an exception when the code is executed by Python just fine?

Platform: win32 pycallgraph: 1.0.1 Python: 2.7

Regards, Robert