AssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59

Jaiky jaiprakashsingh213 at gmail.com
Mon Jul 29 08:55:19 EDT 2013


learning  web concpt in python 


wrote code in /usr/lib/cgi-bin/hello_world.py

###########################################################################
#!/usr/bin/env python

import webapp2


form ="""
    <form action="http://www/google.com/search">
      <input name="q">
      <input type="submit">
    </form>"""


class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.out.write(form)



class TestHandler(webapp2.RequestHandler):
    def get(self):
        q=self.request.get("q")
        self.response.out.write(q)

apps = webapp2.WSGIApplication([('/', MainPage),('/testform',TestHandler)],debug=True)


def main():
    apps.run()


if __name__ == '__main__':
    main()
 

###############################################################################

when running this code on ubuntu 12.04 using command 

python hello_world.py

error obtained 


AssertionError: Headers already set!
Status: 500 Internal Server Error
Content-Type: text/plain
Content-Length: 59


##########################################################################

want help please urgent  ....................




More information about the Python-list mailing list