cudadog / pydot

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

incorrect path search in find_graphviz() #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install (multiple versions of) graphviz into multiple locations
2. Include in PATH more than one directory containing graphviz
3. call pydot.find_graphviz()

What is the expected output? What do you see instead?

I expect the first executable in the path.  pydot.find_graphviz() finds the
last executable in the path.

What version of the product are you using? On what operating system?

pydot-0.9.10, python-2.5, Ubuntu 7.04 (Intel 32-bit)

Please provide any additional information below.
Reordering the loops and inserting breaks ought to produce correct results:
        for prg in progs.keys():
                for path in os.environ['PATH'].split(os.pathsep):
                        if os.path.exists(path+os.path.sep+prg):
                                progs[prg] = path+os.path.sep+prg
                                break
                        elif os.path.exists(path+os.path.sep+prg + '.exe'):
                                progs[prg] = path+os.path.sep+prg + '.exe'
                                break

Original issue reported on code.google.com by Li.Any...@gmail.com on 18 Sep 2007 at 10:37

GoogleCodeExporter commented 9 years ago
Makes sense that it should take the first executable found in the path. I'll 
apply
your fix in the next release.

Thanks.

Original comment by ero.carr...@gmail.com on 19 Sep 2007 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 14 Feb 2008 at 10:07