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

Terry Reedy tjreedy at udel.edu
Mon Jul 29 12:39:52 EDT 2013


On 7/29/2013 8:55 AM, Jaiky wrote:
> learning  web concpt in python
> wrote code in /usr/lib/cgi-bin/hello_world.py
>
> ###########################################################################
> #!/usr/bin/env python
>
> import webapp2

This is an external package.

> 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!

This all comes from webapp2. You should never see assertion error. 
Report to authors or ask on webapp2 mailing list if there is one.

> Status: 500 Internal Server Error
> Content-Type: text/plain
> Content-Length: 59

You should have made subject line something  like
"Webapp2: AssertionError"
as only someone familiar with webapp2 could give you any help.

-- 
Terry Jan Reedy




More information about the Python-list mailing list