Python + Apache 1.3.x (CGI) not working (no mod_python)

Steve Tregidgo smst at bigfoot.com
Fri Jul 14 06:10:10 EDT 2000


In article <8kmjlb$vji$1 at nnrp1.deja.com>,
  genablu at my-deja.com wrote:
> Please help!
>
> I am running the following Python program:
>
> #!/usr/bin/python
>
> print 'Content-type: text/plain'

# Here's your problem:
> print ' '

> print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">'
> print '<HTML><HEAD><TITLE>cgi-bin test</TITLE></HEAD>'
> print '<BODY>Hello, World!</BODY></HTML>'
>
> in my /home/httpd/cgi-bin directory.  Permissions are set to 755,
> chown root.nobody.
>
> When I try requesting http://myserver.domain.com/cgi-bin/hello.py I
> get the following error:
>
> INTERNAL SERVER ERROR
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
>
> malformed header from script.  Bad header=:/home/httpd/cgi-
bin/hello.py
>

The blank line following headers must consist of only a newline ('\n'
or '\r\n'), but you're printing a space on that line.  Try changing
this:

  print ' '

...to this:

  print # no args at all

By not ending the headers correctly, every line you print is treated as
a header -- and since none of them have correct header format, you get
problems.

HTH,
Steve

--
Steve Tregidgo
Software Developer
http://www.businesscollaborator.com


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list