Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51442 > unrolled thread

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

Started byJaiky <jaiprakashsingh213@gmail.com>
First post2013-07-29 05:55 -0700
Last post2013-07-29 12:39 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  AssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59 Jaiky <jaiprakashsingh213@gmail.com> - 2013-07-29 05:55 -0700
    Re: AssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59 Terry Reedy <tjreedy@udel.edu> - 2013-07-29 12:39 -0400

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

FromJaiky <jaiprakashsingh213@gmail.com>
Date2013-07-29 05:55 -0700
SubjectAssertionError: Headers already set! Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59
Message-ID<2cfddec4-58bf-4694-8ac4-de4f4768bc50@googlegroups.com>
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  ....................

[toc] | [next] | [standalone]


#51459

FromTerry Reedy <tjreedy@udel.edu>
Date2013-07-29 12:39 -0400
Message-ID<mailman.5242.1375116004.3114.python-list@python.org>
In reply to#51442
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web