GAE Python AssertionError:write()参数必须为字符串 [英] GAE Python AssertionError: write() argument must be string
问题描述
我正在使用Sublime Text 2作为编辑器,并创建一个新的Google App Engine项目.
I am using Sublime Text 2 as my editor and creating a new Google App Engine project.
我正在通过本地主机运行此代码.在appspot上查看应用程序时出现此错误:
Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59 A server error occurred. Please contact the administrator.
I am running this code through localhost. I get this error on when viewing the app on appspot:
Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59 A server error occurred. Please contact the administrator.
我有此代码:
import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class IndexPage(webapp.RequestHandler):
def get(self):
self.response.out.write('Hello, World!')
app = webapp.WSGIApplication([('/.*', IndexPage)], debug = True)
def main():
run_wsgi_app(app)
if __name__ == '__main__':
main()
它会导致AssertionError:
It causes an AssertionError:
写入文件"C:\ Python27 \ lib \ wsgiref \ handlers.py"第202行
File "C:\Python27\lib\wsgiref\handlers.py", line 202, in write
声明类型(数据)为StringType,"write()参数必须为字符串"
assert type(data) is StringType,"write() argument must be string"
AssertionError:write()参数必须为字符串
AssertionError: write() argument must be string
错误是什么意思,可能是什么原因造成的?
What does the error mean and what could be causing it?
推荐答案
GAE无法正确识别我的app.yaml文件.一旦我解决了,它就起作用了.谢谢
GAE was not recognizing my app.yaml file properly. Once I fixed that, it worked. Thanks
这篇关于GAE Python AssertionError:write()参数必须为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!