From: James Edward Gray II Date: 2011-01-12T07:13:14+09:00 Subject: Re: Read csv file. Beginner's HELP!! On Jan 11, 2011, at 4:07 PM, Kamarulnizam Rahim wrote: > Hai, Hello. > Im new to Ruby programming. Welcome. > I got a job to create a program that can obtain the content from a .csv file into .yml file. However at this stage, im having trouble reading the .csv file. Here is the code i use: > > #!/usr/bin/ruby > > require 'rubygems' > require 'csv' > > CSV.open('C:/Users/nizam/test_q.csv', 'r') do |row| > p row > end > > puts "Hello World" > > Here is the error message i get: > <#CSV io_type:File io_path:"C:/Users/nizam/test_q.csv" encoding:UTF-8 > lineno:0 col_sep:"," row_sep:"\n" quote_char:"\""> That's not actually an error message. It's an inspection of the CSV object open() passed into your block. It looks like you were expecting a row of data though, so switch open() to foreach() and that should get you going. James Edward Gray II