[Tutor] module paths

Gonzalo Garcia-Perate gonzillaaa at gmail.com
Sun Jul 6 00:37:04 CEST 2008


I'm looking at python after a long time. I wanted to build a quick
parser for some rss feeds and have started using feedparser.

When I test my code on the python interactive shell things work fine
but when I try to write it into a file I get the following error:
AttributeError: 'module' object has no attribute 'parse'

this is what I run on the shell:
import feedparser
>>> d = feedparser.parse("http://tedblog.typepad.com/tedblog/atom.xml")
>>> d
{'feed': {'updated': u'2008-07-04T14:11:15Z', 'updated_parsed': (2008,
7, 4, 14, 11, 15, 4, 186, 0), 'links': [{'href':
u'http://blog.ted.com/', 'type': u'text/html', 'rel': u'alternate'},
{'href': u'http://feeds.feedburner.com/TEDBlog', 'type':
u'application/atom+xml', 'rel': u'self'}], 'title': u'TED | TEDBlog',
etc.....

This is what my script (which fails looks like...):
#!/usr/local/bin/python
import feedparser

d = feedparser.parse("http://tedblog.typepad.com/tedblog/atom.xml")
d['feed']['title']

I'm trying to ring this form within textmate or form the terminal at
different locations as (./parse.py)

thanks


More information about the Tutor mailing list