title: Error in deployed GAE RequestHandler using Webapp2
body: <p>I am using the webapp2 framework on Google App Engine, and I'm getting a basic error in one of my Request Handlers.</p>
  
  <p>The app is running ok in the local instance, but causes the following traceback on the deployed version of Google App Engine:</p>
  
  <p>Here's the code:</p>
  
  <pre><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()
  </code></pre>
  
  <p>traceback error:</p>
  
  <pre><code>Traceback (most recent call last):
  
  File "/base/python27_runtime/python27_dist/lib/python2.7/wsgiref/handlers.py", 
  line 86, in run
  
  self.finish_response()
  File "/base/python27_runtime/python27_dist/lib/python2.7/wsgiref/handlers.py", 
  line 127, in finish_response
  
  self.write(data)
  
  File "/base/python27_runtime/python27_dist/lib/python2.7/wsgiref/handlers.py", 
  line 202, in write
  
  assert type(data) is StringType,"write() argument must be string"
  
  AssertionError: write() argument must be string
  </code></pre>
  
  <p>What does this error mean?</p>