ruby-1.9.3-p286


I must be making a very stupid mistake but the following piece of code
gives an error

/Users/soichi/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/csv.rb:1342:in
`initialize': No such file or directory -
~/Dropbox/Ruby/FlightLuggage/airport.csv (Errno::ENOENT)
  from
/Users/soichi/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/csv.rb:1342:in
`open'
  from
/Users/soichi/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/csv.rb:1342:in
`open'
  from csv_manipulate.v1.rb:11:in `<main>'


# the code is
require 'csv'

dir  =  "~/Dropbox/Ruby/FlightLuggage/"
file = "airport.csv"
filename = dir + file

csv_line_read = CSV.open(filename)
header = csv_line_read.shift

csv_line_read.each do |row|
  p row
end


Could anyone point out the mistake I am making here? I have
double-checked the file directory.

soichi

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