GAE Python AssertionError:write()参数必须是字符串

时间:2013-09-11 14:59:08

标签: html google-app-engine python-2.7

我使用Sublime Text 2作为编辑器并创建一个新的Google App Engine项目。

编辑:我通过localhost运行此代码。在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:

  

文件“C:\ Python27 \ lib \ wsgiref \ handlers.py”,第202行,写入

     

断言类型(数据)是StringType,“write()参数必须是字符串”

     

AssertionError:write()参数必须是字符串

错误是什么意思以及可能导致错误的原因是什么?

1 个答案:

答案 0 :(得分:0)

GAE无法正确识别我的app.yaml文件。一旦我修复了它,它就有效了。感谢