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.

···

--
Posted via http://www.ruby-forum.com/.

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.

···

Am 22.11.2012 13:07, schrieb ajay paswan:

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.

--
<https://github.com/stomar/&gt;

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.

--
Posted via http://www.ruby-forum.com/\.

ajay paswan wrote in post #1085970:

unknown wrote in post #1085940:

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

···

Am 22.11.2012 13:07, schrieb ajay paswan:

--
Posted via http://www.ruby-forum.com/\.