0

I have classical python server. I made a CGI script. I would like from a click in the client side, execute a script in the server side and screen the result in the same page dynamically in the client side.

I know how to update dynamically a page in the client side but I didn't find a way to do it from the server side.

For instance my initial webpage:

print 'Content-type: text/html'# image/svg+xml'
print '''
    <html>
    <head>
    </head>

    <body>
    <h1>My PAGE</h1>

    <a href=#1" onclick="launcher(arg);">Execute my program</a>
    <div id="1" style="display: none;" name="resul1"></div>
    </body>
    </html>
    '''

I would like to execute a script in the server when we click like this kind of execution:

command = "python myscriptinLocal.py -a %s"%(arg)
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process.wait()

A result file is generated in the server, and I would like to screen the result in the current page without to generated a new page....

Is it possible? Is there a way to do that with python or with another language?

1 Answer 1

2

You can use any one of python WSGI frameworks to do exactly that. Just sign a free account with Google App Engine and you will be able to do that immediately. Although you may not be able to spawn your own process nothing will stop you from executing your python script and output it as html! Google app engine pages in Stack: https://stackoverflow.com/questions/tagged/google-app-engine?sort=votes

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I'm gonna search on this way ;) I really don't know this kind of stuff but I'm sure it seems very powerfull! Thank again for your advices :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.