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.
精彩评论