Passing arguments to python from URL

Casey Bralla Nobody at Nowhere.com
Wed Mar 23 02:40:31 CET 2005


I've got a python cgi-bin application which produces an apache web page.  I
want to pass arguments to it on the URL line, but the parameters are not
getting passed along to python properly.

I've been using sys.argv to pick up command line arguments, and it works
fine when I call the python program from the command line.  Unfortunately,
when I pass data to the program from the URL, many of the parameters are
being clobbered and **NOT** passed to python.


For example:  "http://www.nobody.com/cgi-bin/program.py?sort=ascending" only
passes the parameter "/usr/lib/cgi-bin/program.py".  

However, "http://www.nobody.com/cgi-bin/program.py?sort%20ascending" passes
a 2-place tuple of ("/usr/lib/cgi-bin/program.py", "sort ascending").

Somehow, adding the "=" in the argument list prevents **ANY** parameters
from being passed to python.  I could re-write the python program to work
around this, but I sure would like to understand it first.


Can anybody explain this weird behavior?

(Please reply to the news group...  my eMail address is a phony to prevent
spam.)





More information about the Python-list mailing list