From: "Ara.T.Howard" Date: 2005-10-22T00:02:04+09:00 Subject: Re: gnuplot on ruby On Fri, 21 Oct 2005, gordon.j.miller@gmail.com wrote: > Ara.T.Howard wrote: >> On Fri, 21 Oct 2005, soxinbox wrote: >> >>> I installed gnuplot gem, and I am getting some syntax errors when I try to >>> run the samples on the projects web page. >>> >>>> ruby test.rb >>> c:/programs/ruby/lib/ruby/gems/1.8/gems/gnuplot-2.1/lib/gnuplot.rb:20:in >>> `popen': No such file or directory - which gnuplot (Errno::ENOENT) >>> from >> >> it looks like the code must do >> >> IO::popen `which gnuplot` >> >> so either >> >> - gnuplot is not on your system >> >> - gnuplot is not in your path >> >> can you verify both of these? from the shell do >> >> ~:> which -a gnuplot >> > > Ara is completely correct with his diagnosis. You have two choices, either > ensure that gnuplot is in your path or hardcode the path in the gnuplot.rb > file. I've struggled for a number of years on how to improvie this but > haven't been able to come up with something better that satisfies my sense > of right and wrong. Suggestions would be appreciated. maybe somthing like (un-tested): def which bin path = ENV['PATH'] # || ENV['WHAT_EVER_WINDOWS_PATH_VAR_IS'] path.split(File::PATH_SEPARATOR).each do |dir| candidate = File::join dir, bin return candidate if File::executable? candidate end return nil end gnuplot = ENV['RB_GNUPLOT'] || 'gnuplot' gnuplot = which gnuplot or raise 'gnuplot is not in your path' or, if windows isn't a concern gnuplot = `which gnuplot` raise 'gnuplot not in your path' unless $? == 0 IO::popen gnuplot thanks for the good work on gnuplot btw - i've used in many times. cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama ===============================================================================