昨天我安装了feedparser (在OSX 10.5上),它工作得很好,但现在它停止工作了。
这是脚本(从feedparser文档中复制)
import feedparser
d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')
d['feed']['title']
u'Sample Feed'它告诉我:
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'但使用feedparser的实际脚本也停止了工作,同样的错误。
发布于 2011-02-08 22:47:05
关键是,当有一个名为feedparser.py的脚本时,python会将其视为要导入的模块,其优先级高于已安装的模块。
发布于 2016-09-20 11:05:27
文件名有问题。Python混淆了文件名和模块名。
https://stackoverflow.com/questions/4934204
复制相似问题