[Tutor] module paths

arsyed arsyed at gmail.com
Sun Jul 6 08:03:59 CEST 2008

I copy/pasted your script and it ran fine on my end. Is it possible that
you've got more than one installation of python and the feedparser module is
installed somewhere other than for the python interpreter at
/usr/local/bin/python (since that's what your script references)? Perhaps
trying "python parse.py" will help since your code when you invoke the
python shell.

On 7/5/08, Gonzalo Garcia-Perate <gonzillaaa at gmail.com> wrote:
> 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
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080706/41dae043/attachment.htm>

More information about the Tutor mailing list