From: James Edward Gray II Date: 2010-02-18T07:10:20+09:00 Subject: Re: CSV: what is the problem ? On Feb 17, 2010, at 3:57 PM, François Boone wrote: > I have updated my ruby from 1.8.6 to 1.9.1 > > I used with ruby 1.8.6 > FasterCSV.foreach(fichier, :col_sep =>';', :row_sep =>:auto) do |ligne| > where 'fichier' in the name of my file > and all is ok > > Now, I have to change this line to use my program with ruby 1.9.1: > CSV.foreach(fichier, :col_sep => ";") do |ligne| > gives > /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `initialize': can't convert > String into Integer (TypeError) > from /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `open' > from /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `open' > from aipsa2.rb:63:in `
' Your example works fine for me with Ruby 1.9: $ echo '1;2;3' > data.csv $ ruby -v -r csv -e 'CSV.foreach(ARGV.shift, :col_sep => ";") { |row| p row }' data.csv ruby 1.9.2dev (2009-07-18) [i386-darwin10.0.0] ["1", "2", "3"] Very little changed with CSV between 1.9.1 and 1.9.2 and I expect it to work on the lower version too. James Edward Gray II