Newbie : Installing Python locally in acct on shared server

brian donovan usenet at lophty.com
Mon Dec 3 02:39:51 CET 2001


Thanks for the reminder about the headers.

After telling the scripts to print headers, the one that uses sys now 
works, printing "path has 6 members", but the base64 one still craps out.

Each time that I attempt to access the page, 3 lines are added to my 
Error log :

[Sun Dec  2 20:15:21 2001] [error] [client 208.59.249.9] Premature end 
of script headers: /home/luser/public_html/test/cgi-bin/base64.py
   File "/home/luser/public_html/test/cgi-bin/base64.py", line 6, in ?
   File "/home/luser/public_html/test/cgi-bin/base64.py", line 3, in ?

  The script is :

------------------------------------------

#!/home/luser/bin/python

import base64

message = "life of brian"
data = base64.encodestring(message)

original_data = base64.decodestring(data)

print "Content-type: text/plain\n"

print "original : ", repr(message)
print "encoded data : ", repr(data)
print "decoded data : ", repr(original_data)

------------------------------------------

Except for the addition of the print statement for the headers, this 
script, like the original sys script, was sopied verbatim from a python 
text.

Is it a problem with the script?

I'm going to try more examples and see what happens.
:D

thanks,
brian

Chris Gonnerman wrote:

> Ahh... I just realized you aren't giving the web server 
> the correct headers.  Try this:
> 
> --------------------------------------------
> #!/home/luser/bin/python
> 
> import sys
> 
> print "Content-type: text/plain\n"
>  
> print "path has", len(sys.path), "members"
> --------------------------------------------
> 
> and let me know what happens...




More information about the Python-list mailing list