RSS::Parser only returns nil

C

Cody Robbins

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
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"RSS::parser only returns nil" on Thu, 17 Apr 2008 13:29:02 +0900,
Cody Robbins said:
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.

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

% ruby -r rss -e 'puts RSS::VERSION'


Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top