Calling python module in cgi script

W

Wroozee

hi,

I am pretty new to python and i came up with this problem. What i'm
trying to do is call a python module from my cgi script, which is
inovked by a html form.

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.

Thanks,
Wroozee

PS: I can post my code if anyone wants to see it.
 
J

John J. Lee

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top