Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > BOOK: Beginning Python
|
BOOK: Beginning Python
This is the forum to discuss the Wrox book Beginning Python by Peter C. Norton, Alex Samuel, Dave Aitel, Eric Foster-Johnson, Leonard Richardson, Jason Diamond, Aleatha Parker, Michael Roberts; ISBN: 9780764596544
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Python section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2006, 10:58 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running CGI script, page 469

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.

 
Old March 21st, 2006, 11:18 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

 
Old September 28th, 2006, 04:07 AM
Registered User
 
Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Script of 2005 to 2000 prashantlakhlani SQL Server 2000 0 August 24th, 2006 09:14 AM
Auto Running a script. rupen Classic ASP Basics 3 July 19th, 2005 06:14 PM
running CGI in Apache-Linux sunilosunil Linux 2 March 29th, 2005 04:51 AM
Transferring parameters to a CGI page takabyte Classic ASP Basics 0 July 9th, 2003 12:20 PM
Call and run CGI script from a PHP script ... how? dbruins BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 10th, 2003 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.