mgedmin / objgraph

Visually explore Python object graphs
http://mg.pov.lt/objgraph/
MIT License
753 stars 72 forks source link

Graphs not being saved to pngs #29

Closed Martmists-GH closed 5 years ago

Martmists-GH commented 7 years ago

Using the example from the docs:

>>> x = []
>>> y = [x, [x], dict(x=x)]
>>> import objgraph
>>> objgraph.show_refs([y], filename="x.png")
Graph written to C:\Users\Userame\AppData\Local\Temp\objgraph-99xk348b.dot (4 nodes)
Image renderer (dot) not found, not doing anything else

Despite having graphviz and xdot installed.

mgedmin commented 7 years ago

Is dot.exe on your %PATH%?

Martmists-GH commented 7 years ago

It is.

mgedmin commented 7 years ago

The bug is probably in the _program_in_path() function. You can verify that by trying to see whether objgraph._program_in_path('dot') returns False.

Can you tell me the value of os.environ.get('PATH'), and also the actual location of dot.exe?

elfxiong commented 7 years ago

I am getting the same error message. For me, xdot instead of dot is in the %PATH%. Isn't it supposed to save to a image file even if xdot is not installed?

mgedmin commented 7 years ago

Isn't it supposed to save to a image file even if xdot is not installed?

Yes, provided that dot is installed.

I'm still awaiting additional information (e.g. answers to my earlier questions) since I cannot reproduce this problem myself.

elfxiong commented 7 years ago

Oh, I just figured that dot is different from xdot, and is installed by Graphviz (not the Python package of the same name).

I don't have this problem any more after installing Graphviz and making sure dot.exe is in the %PATH%.

luofengwei commented 5 years ago

I mad the same mistake. When i use 'pip install graphviz', it has no dot.exe, only dot.py.

I don't have this problem any more after installing graphviz.mis from "https://graphviz.gitlab.io/_pages/Download/Download_windows.html"