Calling python module in cgi script

Discussion in 'Python' started by Wroozee, Apr 6, 2004.

  1. Wroozee

    Wroozee Guest

    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.
    Wroozee, Apr 6, 2004
    #1
    1. Advertising

  2. Wroozee

    John J. Lee Guest

    (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
    John J. Lee, Apr 6, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shailan
    Replies:
    2
    Views:
    923
    Shailan
    Dec 15, 2003
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    547
    Michael Sparks
    Jul 30, 2005
  3. Amir  Michail

    cgi relay for python cgi script

    Amir Michail, Oct 4, 2005, in forum: Python
    Replies:
    7
    Views:
    400
    Michael Ekstrand
    Oct 4, 2005
  4. fatted
    Replies:
    1
    Views:
    129
    Steve Grazzini
    Jul 25, 2003
  5. kath
    Replies:
    4
    Views:
    585
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page