Re: An error ?

Discussion in 'Python' started by Steve Holden, Jun 12, 2006.

  1. Steve Holden

    Steve Holden Guest

    Bo Yang wrote:
    > Hi ,
    > I am confronted with an odd question in the python cgi module !
    >
    > Below is my code :
    >
    > import cgitb ; cgitb.enable()
    > import cgi
    >
    > print "Hello World !"
    >
    > How easy the script is , and the url is 202.113.239.51/vote/cgi/a.py
    > but apache give me a 'Server internal error !'
    > and the error log is :
    >
    >
    > [Fri Jun 16 14:06:45 2006] [error] [client 10.10.110.17] malformed
    > header from script. Bad header=Hello World!: a.py
    >
    > I wish somebody could help me , thanks in advance !
    >

    You don't include any HTTP headers. This is easily corrected: try instead:

    import cgitb ; cgitb.enable()
    import cgi

    print "Content-Type: text\plain\n"
    # note the extra blank line terminate the headers
    print "Hello World !"


    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Love me, love my blog http://holdenweb.blogspot.com
    Recent Ramblings http://del.icio.us/steve.holden
     
    Steve Holden, Jun 12, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    2
    Views:
    21,706
  2. JavaQueries
    Replies:
    1
    Views:
    3,710
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,140
  4. Bishop
    Replies:
    1
    Views:
    807
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,065
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page