根目录中的feedparser.py,但仍无法在开发服务器上工作 [英] Feedparser.py in root directory but still not working on dev server

查看:102
本文介绍了根目录中的feedparser.py,但仍无法在开发服务器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目目录中有feedparser.py,但是我的代码在适用于Google App Engine的本地google dev服务器上不起作用.

I have the feedparser.py in my project directory but my code does not work on the local google dev server for google app engine.

我收到此错误

  File "/home/ahmad/GAE/livemetals/lv.py", line 34, in <module>
    d = feedparser.parse(url)
AttributeError: 'module' object has no attribute 'parse'
INFO     2012-06-23 16:13:25,891 dev_appserver.py:2891] "GET / HTTP/1.1" 500 -

这是我正在使用的代码

url = "http://www.mysite.com"

d = feedparser.parse(url)
articles = {}
for row in d.entries:
    temp = [row['link'].encode('utf-8'),row['title'].encode('utf-8'),row['summary'].encode('utf-8')]
    articles.append(temp)

我可以在非Google App Engine python脚本上使用feedparser.但是,当我复制"feedparser.py"时,即使将其作为以下对象导入,我仍然无法使其在我的项目中正常工作

I can use feedparser on a non-google app engine python script. However when i copy "feedparser.py" i still can't get it to work in my project even though i import it as folows

import feedparser

如何让feedparser在我的GAE项目中工作?谢谢你的帮助

How do I get feedparser to work in my GAE project? thanks for the help

推荐答案

在我看来,GAE python运行时正在查找另一个feedparser模块.
您的项目中是否还有另一个feedparser.py脚本?
我会尝试打印feedparser.__file__来检查项目所指向的模块.

It seems to me that the GAE python runtime is finding another feedparser module.
Do you have another feedparser.py script in your project?
I would try to print the feedparser.__file__ to check where the module your project is pointing to.

这篇关于根目录中的feedparser.py,但仍无法在开发服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆