11

I keep getting this No such file or directory error when trying to open a file. I'm doing:

file = open("http://farm7.static.flickr.com/6064/6090089285_242ca0e342_m.jpg") according to the ruby-doc and keep getting such error.

What am I doing wrong?

Gustavo
  • 235
  • 4
  • 11
  • possible duplicate of [I want to download a file from a URL to save it. Any Rails way to do this or can I do with Ruby File Handling?](http://stackoverflow.com/questions/2515931/i-want-to-download-a-file-from-a-url-to-save-it-any-rails-way-to-do-this-or-can) – Andrew Marshall Dec 12 '11 at 18:58

1 Answers1

18

You have to

require 'open-uri'

Without requiring 'open-uri', I got this exact error mesage in my irb: Errno::ENOENT: No such file or directory

Marek Příhoda
  • 11,108
  • 3
  • 39
  • 53