title: No such file or directory: 'results.txt'
body: <p>I'm trying to write to a txt file but faced the following error message: <strong>[Errno 2] No such file or directory: 'results.txt'</strong>. The results.csv file contains data separated by pipeline delimiters. May I know what went wrong and how do I solve this?</p>
  
  <pre><code>results_path = "results.csv"
  dest_path = "results.txt"
  
  def row_count(results_path):
      return len(open(results_path).readlines())
  
  def add_header_footer(results_path, dest_path, file_name, date_today):
      with open(results_path) as from_file, open(dest_path) as to_file:
          header = 'H|ABC|' + file_name + '|' + date_today + '\n'
          footer = 'E|' + str(row_count(results_path)) + '|\n' 
  
          to_file.write(header)
          shutil.copyfileobj(from_file, to_file)
          to_file.write(footer)
  
  add_header_footer(results_path, dest_path, 'Results_Today', '20190818')
  </code></pre>