[Mpls-pm] Working with objects returned by functions in Inline::Python

Ian Malpass ian at indecorous.com
Wed Jul 14 09:30:09 CDT 2004


I'm doing some stuff with RSS aggregation, and I'd like to use Mark
Pilgrim's 'liberal' feed parser[0] (because XML::RSS is annoying me). The
parser is written in python, but my app is built in perl. Much as I'd like
to (a) learn python and (b) rewrite the whole app, I thought I'd try to
use Inline::Python instead.

feedparser.py has a parse method, which returns an object which I *think*
is an instance of FeedParserDict. I can get feedparser loaded, and I can
call parse, but I get an Inline::Python object back which I've no idea how
to use.

The docs suggest

>> import feedparser
>> d = feedparser.parse('http://feedparser.org/docs/examples/atom.xml')
>> d['feed']['title']
>u'Sample Feed'

although it does look like d.feed.title would also work.

However, if I run the following:

  #!/usr/bin/perl -w
  use Inline Python => 'from feedparser import parse';
  $f = parse("http://www.indecorous.com/golb/golb.rss");
  print $f->feed();

I get "Attempted to call non-method 'feed'".

I've tried importing the class FeedParserDict too but that hasn't helped.

So, how do I access the results of calling parse?

Thanks,

Ian

[0] <http://feedparser.org/>

-
--
------------------------------------------------------------------------

The soul would have no rainbows if the eyes held no tears.

Ian Malpass                     ian at indecorous.com




More information about the Mpls-pm mailing list