Flickr.rb

If you’re just starting with flickr.rb and are getting an error like

ArgumentError: File does not exist: .
   from /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.12/lib/
  xmlsimple.rb:984:in `find_xml_file'
   from /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.12/lib/
  xmlsimple.rb:168:in `xml_in'
   from /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.12/lib/
  xmlsimple.rb:203:in `xml_in'
   from /usr/local/lib/ruby/gems/1.8/gems/flickr-1.0.2/./
  flickr.rb:67:in `request'
   from /usr/local/lib/ruby/gems/1.8/gems/flickr-1.0.2/./
  flickr.rb:149:in `method_missing'
   from /usr/local/lib/ruby/gems/1.8/gems/flickr-1.0.2/./
  flickr.rb:121:in `users'
   from (irb):5

Then you should change @host = ‘http://flickr.com’ to @host = ‘http://www.flickr.com’ in Flickr.initialize. Flickr now redirects flickr.com to www.flickr.com as part of an SEO strategy, I suppose, but this redirect breaks the code. An XML document is not returned, just an HTML header, hence the message above.

Sidenote: if you’re not sure why things aren’t working, make sure you’re giving it an API key whenever you create the Flickr object:

flickr = Flickr.new(‘myf71ckr4p1k3ymyf7lckr4plk3ymyf7’)

Hope this helps a few newbies (like me) to the Flickr.rb library!

posted 2 years ago