error using:
def main():
application = webapp.WSGIApplication(
[('/admin', MainHandler)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)
error message:
ERROR 2012-11-05 08:32:42,655 traceback.py:13] File “C:\Python27\lib\wsgiref\handlers.py”, line 86, in run
ERROR 2012-11-05 08:32:42,655 traceback.py:13] self.finish_response()
ERROR 2012-11-05 08:32:42,655 traceback.py:13] File “C:\Python27\lib\wsgiref\handlers.py”, line 127, in finish_response
ERROR 2012-11-05 08:32:42,655 traceback.py:13] self.write(data)
ERROR 2012-11-05 08:32:42,655 traceback.py:13] File “C:\Python27\lib\wsgiref\handlers.py”, line 202, in write
ERROR 2012-11-05 08:32:42,655 traceback.py:13] assert type(data) is StringType,”write() argument must be string”
ERROR 2012-11-05 08:32:42,655 traceback.py:13] AssertionError: write() argument must be string
Fix code:
def main():
application = webapp.WSGIApplication(
[('/admin', MainPage)],
debug=True)
run_wsgi_app(application)
########################################
same Error message for this code:
1. self.response.out.write(template.render(path, template_values))
2.
content = template.render(path, template_values)
self.response.out.write(content.encode(‘utf-8′))