From: ara.t.howard@... Date: 2006-08-03T23:56:23+09:00 Subject: Re: How to tell when IO::popen is finished? On Thu, 3 Aug 2006, Daniel N wrote: >> I'm using Gnuplot the open method is this works fine on my box: harp:~ > cat a.rb require 'rubygems' require 'gnuplot' PNG = ARGV.shift || 'test.png' def Gnuplot.open( persist=true ) cmd = Gnuplot.gnuplot( persist ) or raise 'gnuplot not found' IO::popen( cmd, "w") { |io| yield io } end def make_chart( ) Gnuplot.open() do |gp| Gnuplot::Plot.new(gp) do |plot| plot.terminal "png" plot.output PNG plot.title "Array Plot Example" plot.ylabel "x" plot.xlabel "x^2" x = (0..200).collect { |v| v.to_f } y = x.collect { |v| v ** 2 } plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds| ds.with = "lines" ds.notitle ds.linewidth = 6 end end end end make_chart p File.stat(PNG) # works if you have image magick installed system "display #{ PNG }" harp:~ > ruby a.rb # i think your issue was '/test2.png' - unless you're root i doubt you can open that file. regards. -a -- we can never obtain peace in the outer world until we make peace with ourselves. - h.h. the 14th dali lama