For some reason I cannot get my CGI Script to work with my Dreamweaver file. I feel like it may have something to do with where I'm saying things are located. For example, the company website that I am working on has its files located on another website. I assume there needs to be a cgi-bin folder where all the web files are located. I placed a cgi-bin folder there with python.exe,, string,py and my python file,

This is part of the code for my form in Dreamweaver. I have highlighted the form action that I placed in the code so that it would be able to read the python file (or supposedly be able to read the file):

<table width="561" height="332" border="0" align="left">

<td width="555" height="328" valign="top"><div align="center"><form action="cgi-bin/" enctype="multipart/form-data">
<table width="453" border="0">
<td width="447"><div align="left"><span
class="style37">Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<input maxlength="40" name="name" />
<br />
<br />
class="style37">Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<input id="email" maxlength="100" size="40"
name="email" />
<br />
<br />
<span class="style37">Company:</span>
id="company" maxlength="100" size="40" name="company" />
<br />
<br />

Part of my (simple) python file is as follows:

print "Content-type: text/html\n\n"

import cgi
import string

def main():
form = cgi.FieldStorage()
print "<head><title>Request Information Sent</title></head>"
print "<body><h1 align = center>"
print "<p>Thank you for your interest in aapptec products. The information has been sent.</body>"
name = form.getvalue("name")
if name == "":
print "No name provided, please go back and provide a name."
print "Hello," + str(name) + "."
print "<font size = '4' face = 'Arial'>"

print "<br>"
print "<br>"

email = form.getvalue("email")
if email != "":
print "Email: " + str(email) + "<br>"
print "No email provided.<br>"

However, when I type something in the fields on the form and click submit, one of two things either pops up. First, it says that the page cannot be found (which obviously has something to do where things are located). Second, it says that I have used an invalid HTTP verb. The URL comes up to be:

Any help would be GREATLY appreciated!!!!! If there is anything else that you need to know to help me, then please let me know!! Thanks so much.

ok, first off, the server needs to be able to run python...

make sure it has python installed, set the mime type, and make sure python can be found on the system path (if you cannot do this and the site host doesnt have it configured, stop here... you will need to use another language thats supported by the server such as php or perl)

also, you need to make the permissions of the files such that the server has the ability to execute and read the files (chmod 755 on a linux system).

usually a hosting company will have the ability to do all this for you (though you may need to ask their moderators or admins if they have python available for you to use, and for a module list if they do so you know what modules you can use). my experience is that most commercial hosts DO have python even if it is not advertised and you almost always have to configure the mime type yourself (even if they do advertise python availability). If this is not a comercial hos, and is instead your client companies own server, then you will need to talk to their network admin if you want python installed for you, otherwise your shit out of luck.

lastly, wherever you have an executable script such as cgi or py files, you need explicit permission to execute those scripts within the directory they are contained in.

Obviosly, your gonna need to contact some people to find out some answers now, i just hope this helped.

as a side note, if you cant get access to python, there is always client side java scripting which should work regardless of the server, but may not have all the functionality you wanted your python scripts to be capable of.

This article has been dead for over six months. Start a new discussion instead.