Calling python module in cgi script

John J. Lee jjl at pobox.com
Tue Apr 6 16:50:11 EDT 2004


wroozee at hotmail.com (Wroozee) writes:
[...]
>  First the cgi script gets a value from the form and sends it to the
> python module which takes that value and processes it and sends the
> result back to the cgi script which again processes it and show the
> result.How do i do that? Any suggestion is greatly appreciated.
[...]

Just import your module and have at it:

#!/usr/local/bin/python -u

import cgi
...

import my_module
info = my_module.process(some_cgi_data)


There is no need for your module to run in a separate process from
your other module, hence no need for any complicated 'sending back and
forth' of data.


John



More information about the Python-list mailing list