can't load an script from html...

R

Ricardo

Hi everyone
I'm trying to use the cgi library to create a python script and loading it from a web page. I have already done the necessary imports, and the default commands to receive data from "html" are written too. The final version is something like this:

#!/usr/bin/python

import subprocess
import cgi
import cgitb

cgitb.enable()

input = cgi.FieldStorage()

…. my code (do something with input)….


#printing the response

print "Content-Type: text/html"
print
print "<TITLE>My title:</TITLE>"
print "</HEAD>"
print "<BODY>"
print ….. bla bla …
print "%s"%theoutput
print "</BODY>"

Besides, my call from my index.html is like this:

<form action="/scripts/python_script.py" method="post">
<input name="inid" type="text" size="20" class="input" /><br/><br/>
<input type="submit" value="accept" class="button"/>
</form>

well, the thing is that when i do the call from the browser:

http://localhost/index.html
|
V
put the data and click on the "accept" button
|
V
http:/localhost/scripts/python_script.py

I only get the python_script.py as a plain test by response (the script printed on my browser).
I have already changed the permissions for python_script.py. I have checked the import cgi,cgitb in the python shell (i am using v2.7) and they work fine. So, i don't know what it is going wrong here.

A little help please… any idea?
Thanks anyway for your time.
 

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,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top