[Tutor] Apache, CGI-BIN, Python

2007-09-09 Thread Ryan
I am running a Linux box and cannot find my Apache cgi-bin to put some 
python scripts in. I know I probably have to create one but don't know 
where and how.

Also on my windows machine,where I do have the bin, and normally 
everything works fine except:

#!c:/Python25/python
import cgi

reshtml = """Content-type: text/html\n\n"

Hello Python


Welcome To A Python Script!

"""

form = cgi.FieldStorage()

#This is where everything goes wrong
#I get error messages for either the lastname line or firstname

lastname = form['lastname'].value
firstname =form['firstname'].value
message = firstname + " " + lastname
print reshtml % message
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Apache, CGI-BIN, Python

2007-09-09 Thread Steve Willoughby
Ryan wrote:
> I am running a Linux box and cannot find my Apache cgi-bin to put some 
> python scripts in. I know I probably have to create one but don't know 
> where and how.

On Linux under Apache 2.2, I've seen it in /usr/lib/cgi-bin which always 
struck me as weird, but there you go.  On BSD, it tends to live in 
/var/www/cgi-bin.

YMMV.

> 
> Also on my windows machine,where I do have the bin, and normally 
> everything works fine except:
> 
> #!c:/Python25/python
> import cgi
> 
> reshtml = """Content-type: text/html\n\n"
> 
> Hello Python
> 
> 
> Welcome To A Python Script!
> 
> """
> 
> form = cgi.FieldStorage()
> 
> #This is where everything goes wrong
> #I get error messages for either the lastname line or firstname
> 
> lastname = form['lastname'].value
> firstname =form['firstname'].value

What error message do you get?  I'd recommend, actually, using 
form.getfirst('lastname') instead.  It's more robust in case there are 
multiple occurrences of a field on the form the user submits.

You can also check to see if the form even has the fields you're trying 
to read, but again, knowing what error message you're getting would be 
very helpful to point you in the right direction on this.

> message = firstname + " " + lastname
> print reshtml % message

I think you need a %s or something in the reshtml string, too.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Suggested books for Agile Programming & Testing?

2007-09-09 Thread Stephen McInerney


Can anyone recommend me the best single must-read book for Agile 
Programming?

Also Agile Testing.

(If they compare Agile in general to the other methodologies, that would be 
great)


Also, can anyone comment on the limits or caveats of agile development?

Thanks,
Stephen

_
Kick back and relax with hot games and cool activities at the Messenger 
Café. http://www.cafemessenger.com?ocid=TXT_TAGHM_SeptHMtagline1


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor