开发者

Feedparser stopped working

Yesterday I installed feedparser (on OSX 10.5) and it worked fine, but now it stopped working.

This is the script (copied from feedparser documentation)

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

It tells me this:

Traceback (most recent call last):
  File "example.py", line 3, in <module>
    import feedparser
  File "example.py", line 2, in <module>
    d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')
AttributeError: 'module' object has no attribute 'parse'

But also an actual script using feedparser stoppe开发者_如何学God working, same error.


The point is when there is a script named feedparser.py, python will considered it as a module to import with higher priority than the module installed.


Issue is with Name of file. Python confuses between name of file and module name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜