pombreda / pydot

Automatically exported from code.google.com/p/pydot
MIT License
0 stars 0 forks source link

find_graphviz() fails on Windows with GraphViz 2.26.3 #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
GraphViz 2.26.3 (which I installed just today) uses a different registry key to 
store the install path.  Instead of "SOFTWARE\ATT\Graphviz" the key used is 
"Software\AT&T Research Labs\GraphViz".

The simplest solution is to check the both locations.

for regkey in ("SOFTWARE\ATT\Graphviz",
               "SOFTWARE\AT&T Research Labs\GraphViz") :
    try :
        hkey = win32api.RegOpenKeyEx( win32con.HKEY_LOCAL_MACHINE,
            regkey, 0, win32con.KEY_QUERY_VALUE )
    except win32api.error :
        continue
    else :
        break
else :
    # Raise error that registry not found
    raise Exception("Unable to find graphviz")

(Modified to fit whatever style conventions you have.)

Since Graphviz puts its bin in the path, a simpler, more logical check, would 
be to just call "dot -V" (or whatever program) and search the output for the 
string "graphviz".

Original issue reported on code.google.com by afog...@gmail.com on 15 Jul 2010 at 2:49

GoogleCodeExporter commented 9 years ago
Whoops, my registry key is "Software\AT&T Research Labs\Graphviz", with a 
lowercase 'v'.  (I doubt the registry is case-sensitive, but just in case.)

Original comment by afog...@gmail.com on 15 Jul 2010 at 2:59

GoogleCodeExporter commented 9 years ago
This patch has the right direction, but is not complete (second 'else :' ). It 
resembles issue 29 with included, more complete patch for this issue. Issue 35 
is also related.

Extra information: Installing Graphviz 2.26.3 on Windows 7 doesn't create 
either registry-key. Applying the patch prevents also error for that case.
This issue and issue 35 could be closed.

Original comment by ndegroot0 on 16 Aug 2010 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 30 Oct 2010 at 5:52

GoogleCodeExporter commented 9 years ago
Issue 35 has been merged into this issue.

Original comment by ero.carr...@gmail.com on 30 Oct 2010 at 5:53

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 30 Oct 2010 at 10:31