Subject: Running CGI script, page 469
Posted By: Genuts Post Date: 3/21/2006 9:58:34 AM
L.S.,

Followed 'try it out'example "Running a CGI script" on page 469 but fails. Below some details for you that you might need to tackle and process this problem.

EasyCGIServer.py and EasyHTTPServer.py run without problem in Komodo. Once fired up the EasyCGIServer.py visiting http://localhost:8000/cgi-bin/hello.cgiis not possible.  Firefox cannot access this cgi-bin folder or execute the cgi script. Similar response occurs with internet explorer.

The following error occurs in my Firefox (v1.5.0.1) browser:

---------------------------------------------------------------------

Error response

Error code 403.

Message: CGI script is not a plain file ('/cgi-bin/').

Error code explanation: 403 = Request forbidden -- authorization will not help.

---------------------------------------------------------------------

There is no "Hello world" seen in my webbrowser as denoted on page 470.

Similar event happes after cmd ==> e:\essay_py attrib -r -h -s -a cgi-bin. While dir /q tells I am the one who has acces to this e:\essay_py\cgi-bin folder. What have I forgot to do (some path variable wrong?), and what does the "Environment variables" in the statement on page 471 means?

Thx in advance for help on this topic

Extra Info:

target folder for example on p469 is e:\eassy_py\cgi-bin\.

py script folder : e:\essay_py\ (contains: EasyCGIServer.py, PrintEnvironment.py, EasyHTTPServer.py)

cgi script folder e:\essay_py\cgi-bin\ (hello.cgi, PrintEnvironment.cgi)

py scripts also downloaded from your web site and still doesn't work!

os system: Windows XP, SP1.
Python v2.4 in c:\prolang\python24. Used ActiveState version of python, run scripts using Komodo v3.5. Have not set any environment variables (includes also none for e:\essay_py\cgi-bin\) myself.

Reply By: Genuts Reply Date: 3/21/2006 10:18:40 AM
Debug output from EasyCGIServer (komodo 3.5):

localhost - - [21/Mar/2006 16:13:10] "GET / HTTP/1.1" 200 -
localhost - - [21/Mar/2006 16:13:11] code 403, message CGI script is not a plain file ('/cgi-bin/')
localhost - - [21/Mar/2006 16:13:11] "GET /cgi-bin/ HTTP/1.1" 403 -
localhost - - [21/Mar/2006 16:13:30] code 403, message CGI script is not executable ('/cgi-bin/hello.cgi')
localhost - - [21/Mar/2006 16:13:30] "GET /cgi-bin/hello.cgi HTTP/1.1" 403 -

Changing attributes at the commandline enables to print PATH_INFO from the PrintEnvironment.py, not from the .cgi. How to fix this?

Reply By: codefire Reply Date: 9/28/2006 4:07:39 AM
You hopefully sorted this by now - but in case anyone else is looking at this...I think the basic problem is that the source files have #!usrbinpython in them and .cgi extension. Unless the cgi extension is associated with the Python run-time the code wont run. The easy way to fix this is change the file extensions from .cgi to .py. I tried changing the bang line to my local setup of c:\python24\python.exe but that didnt work. Hope that helps.


Go to topic 50349

Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156
Return to index page 155
Return to index page 154
Return to index page 153