[mod_python] script works, but I need to understand the difference

Michael Steinfeld mikeisgreat at gmail.com
Thu Jan 19 20:20:52 EST 2006


I gave up on installing mod_python on openbsd temporarily ... if  you
read my last question.

Anyhow,

my apache config looks like this:

This Works
##############################
AddHandler mod_python .psp .py
PythonHandler mod_python.psp
PythonDebug On


This does not
##############################
AddHandler python-program .py .psp
PythonHandler mod_python.publisher
PythonDebug On


Should I be using mod_python.publisher? or the above? I am confused.
Please enlighten me.

Also,

Here is a script I wrote which works fine with the above but not
mod_python.publisher
the error is below the script


############
#  index.psp  #
############
<html>
<%
if form.has_key('name'):
   greet = 'Hello, %s!' % form['name'].capitalize()
else:
   greet = 'Hello there!'
# end
%>
  <h1><%= greet %></h1>
<%
import time
%>
<h1>Current time is
<%= time.ctime() %> </h1>
<%
import os, sys
%>
<h2>Yes, This is a <%= os.name %> based operating system </h2>
<h2>The platform is: <%= sys.platform %></h2>
<h3><%= sys.version %></h3>
<h3><%= os.uname() %></h3>
<h3>
<%=
os.popen( 'uptime' ).read()
%>
</h3>
</html>



#########################
Error

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/opt/local/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
    result = object(req)

  File "/opt/local/lib/python2.4/site-packages/mod_python/publisher.py",
line 98, in handler
    path=[path])

  File "/opt/local/lib/python2.4/site-packages/mod_python/apache.py",
line 457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "/var/www/htdocs/index.py", line 1



    ^

SyntaxError: invalid syntax

--
-mike



More information about the Mod_python mailing list