title: How to find text file in same directory
body: <p>I am trying to read a list of baby names from the year 1880 in CSV format. My program, when run in the terminal on OS X returns an error indicating yob1880.txt doesnt exist. </p>
  
  <pre><code>No such file or directory @ rb_sysopen - /names/yob1880.txt   (Errno::ENOENT)
  from names.rb:2:in `&lt;main&gt;'
  </code></pre>
  
  <p>The location of both the script and the text file is <code>/Users/*****/names</code>.</p>
  
  <pre><code>lines = []
  
  File.expand_path('../yob1880.txt', __FILE__)
  IO.foreach('../yob1880.txt') do |line|
    lines &lt;&lt; line
    if lines.size &gt;= 1000
      lines = FasterCSV.parse(lines.join) rescue next
      store lines
      lines = []
    end
  end
  store lines
  </code></pre>