python CGI scripting

Michael Rentzsch michael.rentzsch at repc.de
Tue May 4 02:33:05 EDT 2004


Am Tue, 04 May 2004 05:56:06 +0000 schrieb jai_uw:

> Hello, 
> 
> I am trying to do CGI scripting with Python, but I have a slight 
> constraint. I do not have the CGI module installed on my machine. Is 
> there anyway I can still do CGI scripting in Python without the CGI 
> module installed?
> 
> I don't have root access to the linux machine I am on, and so I won't 
> be able to install the Python CGI module. All I need to do is access 
> the text box fields of an html form in a Python script. The CGI 
> module makes this really easy, as we can import CGI, but I was 
> wondering if anyone knows a way to do this without using the CGI 
> module. Any input would be greatly appreciated. 
> 
> Thanks,
> 
> Jai Modi

Hello,

of course, this is possible: if you use the GET method (in your html
<form> tag) the submitted data will be saved in the environment variable
QUERY_STRING. If you use POST the data can be read from your cgi's stdin.
In either case you have to decode the data. See:
 http://hoohoo.ncsa.uiuc.edu/cgi/forms.html

Anyway, I'm sure there is a possibility to install the cgi module locally,
see:
 http://www.python.org/doc/current/tut/node8.html
and search for PYTHONPATH.

 Michael Rentzsch
-- 
Stud. of Computer Science
www.repc.de




More information about the Python-list mailing list