Paul Lutus said:
Show us the code that caused the error. It is obviously a real error, but it
is difficult to sort out what it is from the message.
here is part of the script down to the line giving an error (line 8) :
-----------------------------------------
#!/usr/bin/env ruby -w
if ARGV.length==1
xml=""
found=false
root=""
file=ARGV[0]
fxml=file.gsub(/(.*)\.wav/,'\1.xml') # *** LINE 8 ***
rgxstart=Regexp.new("<BWFXML>")
rgxstop=Regexp.new("</BWFXML>")
i=0
File.open(file).each { |l|
[...]
of=File.open(fxml, File::WRONLY|File::EXCL|File::CREAT, 0644)
of.puts xml
}
else
puts "File name missing."
end
-----------------------------------------
sometimes an error given at one line comes from the preceeding one :
file=RGV[0] # line 7
for me the syntax is correct ???
What is in RGV[0]? What is the content of the offending line?
RGV[0] is a typo of mine, it should be read :
ARGV[0]
Maybe you should change the shebang line you are using, or delete one of the
ruby references on your system (you appear to have more than one).
yes i do have three ruby versions installed on my box [Mac OS X Tiger
the latest] :
the default Apple's one : /usr/bin/ruby # version 1.8.2
the MacPort installed : /opt/local/bin/ruby # version 1.8.5
the SVN-jRuby one : /Users/yvon/bin/jruby/bin/jruby # version 1.8.5 (0)
[java]
both MacPort and SVN-jRuby ones are working and cohabit nicely.
the Apple's one doesn't like (i think) the env vars i've setup for the
MacPort one (under /opt) here they are :
export RUBYOPT=rubygems
export GEM_HOME=/opt/local/lib/ruby/gems/1.8
export RUBYLIB=/opt/local/lib/ruby/:/opt/local/lib/ruby/site_ruby/1.8
export RUBYGEMS=/opt/local/lib/ruby/site_ruby/1.8
Using the "/usr/bin/env ruby" shebang line makes an assumption about your
system, that you will always hit the intended Ruby version first. If you
have more than one version installed, you may not hit the intended one,
depending on the order of your search path.
Yes a know that point, my PATH is such a way it hits first the ruby
version below /opt then, if i want to use the Apple's one i have to do :
$ /usr/bin/ruby
notice i might change that using aliases as i've allready done to makes
Ruby and jRuby cohabit nicely :
every command for jRuby is the "same" as the Ruby one with the "prefix"
"j" :
gem install <what u want> -o-> jgem install <what u want>
then may be a solution would be to prefix the commands related to
Apple's Ruby with an "a".
i don't want to install anything for the Apple's version, i want to
leave it untouched.
But this is speculation without seeing the error line and its context.
it was given in the preceeding message, even the line before .