I am using a graphviz library for Python.
When I run the script from terminal, the graph is created, but when I start the script from C program using posix_spawn, I get error message saying that
"ValueError: Program dot not found in path" (I have tried all options: 'neato', 'dot', 'twopi', 'circo', 'fdp', 'nop').
My Python script uses #!/usr/local/bin/python location. I have tried to explicitly use this path and tried out the same sequence:
import pygraphviz as pgv
G = pgv.AGraph(directed=True)
G.add_node(1)
G.get_node(1).attr['label'] = 'hi'
G.draw('test.png', prog='dot')
and it worked
I am lost why after calling script using posix_spawn, the graphviz library cannot find the path anymore.
EDIT:
After adding dot path to: bash_profile, bash_rc, and etc/paths, I get /usr/bin:/bin:/usr/sbin:/sbin when I try printing my path both from Python script and C program, while my echot $PATH has many lines.
Have also tried appending PATH from Python sys.path.append('/opt/local/bin/dot')
P.S. I am using Webots as my IDE