Branch merged, but I think it doesn't go far enough. The default logic (spawn viewer if it's available) is fine for interactive debugging use, not so for automation (e.g. now setup.py --build-images doesn't build any images on my machine, it spawns three xdots showing the three graphs -- an improvement over the old version, which opened three xdots all showing the same objects.dot).
So perhaps objgraph should do this:
* if no filename is specified, create a temp file in /tmp (using the tempfile module) and try to spawn xdot; fall back to producing a png and open it with a viewer of some kind (xdg-open foo.png?), fall back to printing the filename
* if a filename is specified and ends in '.dot', just write the dot file and do nothing
* if a filename is specified and ends in '.png', write a temporary dot file and convert it to png
* if a filename is specified with an unknown extension, raise an error.
Branch merged, but I think it doesn't go far enough. The default logic (spawn viewer if it's available) is fine for interactive debugging use, not so for automation (e.g. now setup.py --build-images doesn't build any images on my machine, it spawns three xdots showing the three graphs -- an improvement over the old version, which opened three xdots all showing the same objects.dot).
So perhaps objgraph should do this:
* if no filename is specified, create a temp file in /tmp (using the tempfile module) and try to spawn xdot; fall back to producing a png and open it with a viewer of some kind (xdg-open foo.png?), fall back to printing the filename
* if a filename is specified and ends in '.dot', just write the dot file and do nothing
* if a filename is specified and ends in '.png', write a temporary dot file and convert it to png
* if a filename is specified with an unknown extension, raise an error.
Thoughts?