[Pythonmac-SIG] Using Python .py scripts for CGI withpersonal web sharing

Chris Barker cbarker@jps.net
Wed, 02 Aug 2000 13:14:58 -0700


Samuel Smith wrote:
> I have the PythonCGISlave applet   in the Web Pages folder not in a
> subdirectory. Do you have both the applet and the .py URL with the
> complete path to Web Pages:cgi-bin.

Yes, I did, but I moved them both to the "Web Pages" folder, just to
make it easier.

> I saw the same error when my applet couldn't find the python core. Is
> the applet running after you invoke the CGI?. If not try running the
> applet by itself see if it loads without the python core not found
> error.

As it happens, I had already tried this, and yes, it will start and run
if I double click on it. Now that I have moved it to the "Web Pages"
folder, it does start when I request a *.py URL, but my script doesn't
run. There are no messages put into the error log either.

> This may be a stupid question but did you build the applet on your
> system from the PythonCGISlave.py

Yes I did. I tried adding some diagnostic messages to PythonCGISlave
(sys.stderr.write() ), but then it just started crashing. I'm kind of
stumped here. Anyone have an idea?

Michael Geary wrote:

>I thought that simply having a script:

>print "hello world"

Well, that should in fact work (it certainly does on my Linux Box with
Apache). Can anyone confirm this for PythonCGISlave?

you might want to add a line like:

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

To let the browser know that it's html, but it should work anyway.

>in a script titled "helloworld.py" would output that text to the 
>browser, but I get error messages in my PythonCGIslave app, and it 
>terminates (but doesn't quit). 

It probably doesn't quit because you have "keep stdio window open on
error exit" check in EditPython Prefs. 

Anyway you are having a problem that isn't because you have a bad cgi
script. there is something else going on, as there is with me.

Can anyone help us figure out what?


Thanks,

-Chris

          
cbarker@jps.net                      ---           ---           ---
http://www.jps.net/cbarker          -----@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Water Resources Engineering       ------   @    ------   @   ------   @
Coastal and Fluvial Hydrodynamics -------      ---------     --------    
------------------------------------------------------------------------
------------------------------------------------------------------------