[Tutor] CGI Question

SA sarmstrong13@mac.com
Tue, 09 Jul 2002 07:40:04 -0500


I've now managed to get the script to work part way. I got rid of the server
error by changing:
#!/usr/bin/env python

To

#!/sw/bin/python

Sw/bin is the directory where my default python is located. For some reason
my Apache setup chokes on the /usr/bin/env executable.

So this fixes the server error. I then set the program to display the value
for the key "pageID", but what I get is a blank page. This makes me wonder
if the value is being passed to the key? Once again the href portion of the
html is:

<a href="http://localhost/cgi-bin/test2?pageID=testtext"
title="TestFile">TestFile</a>

When I click on the link it redirects me to the python script and the script
is being executed, but the value for the dictionary key pageID is not being
displayed.

Below is the test script I wrote:

#!/sw/bin/python

import cgi
import re


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

The_Form = cgi.FieldStorage()

for pageID in The_Form.keys():
    print "The text file is: " + pageID
    
print "Finished!"

Any ideas on what I'm doing wrong and why the script is not receiving the
value 'testtext'?

Thanks.
SA


-- 
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me


On 7/8/02 8:44 PM, "SA" <sarmstrong13@mac.com> wrote:
> When I click on the link I get a server error message. I have everythin
> working correctly because I can run some other python cgi scripts that
> display text messages no problem. The cgi program has the correct executable
> permissions and is located in the correct directory.
> 
> So my question is, what am I doing wrong?
> 
> Parse_qs should take the pageID and produce a dictionary with pageID as the
> key and testtext as the value, correct?
> 
> Do I need to read the value of testtext and store it in a variable to be
> written to the display?
> 
> Thanks.
> SA
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>