RSS::Parser only returns nil

I am trying to use RSS::Parser to parse an RSS feed, like so:

require ‘rss’
require ‘rss/parser’
RSS::Parser.parse(open(‘http://www.macrumors.com/macrumors.xml’).read)

This works exactly as advertised on my development machine, but on the
production machine RSS::Parser#parse only returns nil. Both machines
are running the same versions of Ruby, and I diffed the rss/ lib
directories on the two machines, and there are no differences (i.e.,
they have the exact same copies of the RSS library code).

The problem is not arising from trying to read the data from a URL. In
fact, nil is returned on the production machine whether the RSS is
read from a URL, a file, or entered directly as a string in the parse
call. The same nil result occurs with even a minimal RSS file.

I even copied the entire Ruby lib directory from the production
machine to my development machine, and ran the code using that library
code like so:

ruby -I/path/to/production/library/code -e "require ‘rss’ ; require
‘rss/parser’ ; puts
RSS::Parser.parse(open(‘http://www.macrumors.com/macrumors.xml’).read).inspect
";

It works fine on my development machine with the production library
code.

This is driving me crazy and has wasted so much of my time. Why would
RSS::Parser not be returning an error or some sort of indication of
the problem? Why would it be working on one machine but not on another?

I’m using Ruby 1.8.5 (2006-12-25 patchlevel 12) on both machines. The
development machine is running OS X 10.5, though, and the production
machine is FreeBSD.

Thanks!
Cody

Hi,

In [email protected]
“RSS::Parser only returns nil” on Thu, 17 Apr 2008 13:29:02 +0900,
Cody R. [email protected] wrote:

they have the exact same copies of the RSS library code).

The problem is not arising from trying to read the data from a URL. In
fact, nil is returned on the production machine whether the RSS is
read from a URL, a file, or entered directly as a string in the parse
call. The same nil result occurs with even a minimal RSS file.

Check your RSS Parser version what you’re using on both
environments:

% ruby -r rss -e ‘puts RSS::VERSION’

Thanks,

On Sun, 20 Apr 2008 09:41:41 +0900, Kouhei S. wrote:

RSS:arser.parse(open(‘http://www.macrumors.com/macrumors.xml’).read)
Very interesting…

Is your code available for check-out through http://code.google.com/ or
a
similar open source hosting service?

-Thufir

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs