我正在尝试用feed parse解析一个RSS提要。为了简洁起见,下面的代码被删节了
from google.appengine.api import urlfetch
import feedparser
print 'Content-Type: text/plain'
feed_url = 'http://parsethisurl'
feedinput = urlfetch.fetch(feed_url)
rss_parsed = feedparser.parse(feedinput.content)
......
#some logic here
.........
print "\n".join(episode_info) # printing out the desired output.在我的python解释器上运行得很好,但是当我将我的应用程序添加到gapp engine launcher并尝试通过localhost:10000运行它时,它给出了以下错误
<type 'exceptions.ImportError'>: No module named feedparser
args = ('No module named feedparser',)
message = 'No module named feedparser'我的系统上已经安装了feedparser模块。
>>> sys.version
'2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]'
>>> import feedparser
>>>我在stackoveflow和博客上读过一些文章,说feedparser不能直接在gapp引擎上工作。我听从了建议并使用了urlfetch.fetch(feed_url),但我也得到了一个错误。
PS: gapp launcher上的PythonPath为C:\Python25\python.exe
发布于 2012-02-20 18:47:53
您已经在本地安装了feedparser,因此当您在开发服务器上运行应用程序时,它可以正常工作。但是为了在生产环境中使用feedparser,您需要将它包含在您的项目中,因为GAE不会为您提供这个库。
您需要将feedparser与您的项目文件一起上传。为此,您可以将其复制到应用程序根目录中,然后部署您的应用程序。
https://stackoverflow.com/questions/9359006
复制相似问题