CSV:mode must be 'r', 'rb', 'w', or 'wb'

Why this code is giving error:

code is:
CSV.open(filename, ‘a’) do |csv|
csv<<[a,b,c,d]
end

Error is:

mode must be ‘r’, ‘rb’, ‘w’, or ‘wb’

Note: I want to append.

Am 22.11.2012 13:07, schrieb ajay paswan:

Note: I want to append.

A quick search for the error message shows that
this is a Ruby 1.8 issue…

With Ruby 1.9.3-p194 it works perfectly.

unknown wrote in post #1085940:

Am 22.11.2012 13:07, schrieb ajay paswan:

Note: I want to append.

A quick search for the error message shows that
this is a Ruby 1.8 issue…

With Ruby 1.9.3-p194 it works perfectly.

but am using ruby 1.9.3p327.

ajay paswan wrote in post #1085970:

unknown wrote in post #1085940:

Am 22.11.2012 13:07, schrieb ajay paswan:

Note: I want to append.

A quick search for the error message shows that
this is a Ruby 1.8 issue…

With Ruby 1.9.3-p194 it works perfectly.

but am using ruby 1.9.3p327.

Sure you don’t have two versions installed at once? Try adding to the
top of your script:

puts RUBY_DESCRIPTION

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs