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:inopen’
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’
the code is
require ‘csv’
dir = “~/Dropbox/Ruby/FlightLuggage/”
file = “airport.csv”
filename = dir + file
dir = “~/Dropbox/Ruby/FlightLuggage/”
file = “airport.csv”
filename = dir + file
csv_line_read = CSV.open(filename)
The tilde (~) expansion to the home directory name is a feature provided
by the shell. The operating system knows nothing about tilde. You’ll
need something like ENV[“HOME”]+"/Dropbox/Ruby/FlightLuggage" instead.
Saji N Hameed,
ARC-ENV, Center for Advanced Information Science and Technology,
University of Aizu, Tsuruga, Ikki-machi,
Aizuwakamatsu-shi, Fukushima 965-8580,
Japan