AssertionError: Headers already set! Status: 500 Internal Server

J

Jaiky

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 ....................
 
T

Terry Reedy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top