I'm getting the following error. By commenting / uncommenting
different sections of the code I have identified that the error is
caused by the self.response.out.write(template.render....) section.
Any help troubleshooting this would be greatly appreciated :)
*******************
The code:
*******************
import os
from google.appengine.ext.webapp import template
import webapp2
import logging
class MainHandler(webapp2.RequestHandler):
def get(self):
logging.info('hi there 34')
template_values = {}
self.response.out.write('hello world 4')
path = os.path.join(os.path.dirname(__file__), 'index.html')
## This is the code that causes the bug ##
self.response.out.write(template.render(path,
template_values))
## ## ## ##
debug = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
app = webapp2.WSGIApplication(
[(r'/main', MainHandler)],
debug = debug)
def main():
app.run()
*******************
The Error
*******************
E 2011-12-19 11:19:20.885 Traceback (most recent call last):
E 2011-12-19 11:19:20.885 File "/base/python27_runtime/python27_dist/
lib/python2.7/wsgiref/handlers.py", line 86, in run
E 2011-12-19 11:19:20.885 self.finish_response()
E 2011-12-19 11:19:20.885 File "/base/python27_runtime/python27_dist/
lib/python2.7/wsgiref/handlers.py", line 127, in finish_response
E 2011-12-19 11:19:20.885 self.write(data)
E 2011-12-19 11:19:20.885 File "/base/python27_runtime/python27_dist/
lib/python2.7/wsgiref/handlers.py", line 202, in write
E 2011-12-19 11:19:20.885 assert type(data) is StringType,"write()
argument must be string"
E 2011-12-19 11:19:20.885 AssertionError: write() argument must be
string
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.