RSS::Parser only returns nil

Discussion in 'Ruby' started by Cody Robbins, Apr 17, 2008.

  1. Cody Robbins

    Cody Robbins Guest

    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
    Cody Robbins, Apr 17, 2008
    #1
    1. Advertising

  2. Cody Robbins

    Kouhei Sutou Guest

    Hi,

    In <>
    "RSS::parser only returns nil" on Thu, 17 Apr 2008 13:29:02 +0900,
    Cody Robbins <> wrote:

    > 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,
    --
    kou
    Kouhei Sutou, Apr 20, 2008
    #2
    1. Advertising

  3. Cody Robbins

    thufir Guest

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

    > Hi,
    >
    > In <>
    > "RSS:arser only returns nil" on Thu, 17 Apr 2008 13:29:02 +0900, Cody
    > Robbins <> wrote:
    >
    >> I am trying to use RSS:arser to parse an RSS feed, like so:
    >>
    >> require 'rss'
    >> require 'rss/parser'
    >> 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
    thufir, Apr 20, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Candler

    puts nil generates "nil\n"

    Brian Candler, Nov 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    111
  2. John Carter
    Replies:
    64
    Views:
    638
    Klaus Stein
    May 19, 2005
  3. Christoffer Sawicki
    Replies:
    5
    Views:
    251
    Christoffer Sawicki
    Sep 2, 2006
  4. Mmcolli00 Mom
    Replies:
    11
    Views:
    161
    Mmcolli00 Mom
    Aug 5, 2008
  5. Jonathan Groll
    Replies:
    1
    Views:
    260
    Kouhei Sutou
    Jun 27, 2009
Loading...

Share This Page