[mod_python] How to use CGI handler?

jw9 at softhome.net jw9 at softhome.net
Sun Dec 15 16:44:56 EST 2002


I got a big python CGI script which I would like to rewrite using
mod_python. In the meanwhile, I want to try CGI handler.

Did a simple test using CGI handler, doesn't work well. Here is my config
files, all my scripts are in cgi-bin folder:

httpd.conf:
.......
<Directory "D:/Apache2/cgi-bin">
AddHandler python-program .py
AllowOverride All
PythonDebug ON
</Directory>

.htaccess file under D:/Apache2/cgi-bin:
***********************
SetHandler python-program
PythonHandler mod_python.cgihandler

very simple test script:
***********************
print 'Content-type: text/html\n'
print 'Hello World!'


result:
***********************
Mod_python error: "PythonHandler mod_python.cgihandler" Traceback (most
recent call last): File "D:\PYTHON22\Lib\mod_python\apache.py", line 335, in
HandlerDispatch result = object(req) File
"D:\PYTHON22\Lib\mod_python\cgihandler.py", line 140, in handler
apache.restore_nocgi(env, si, so) File
"D:\PYTHON22\Lib\mod_python\apache.py", line 764, in restore_nocgi for k in
osenv: RuntimeError: dictionary changed size during iteration

I don't what is wrong.  Anybody have the same experience? By the way, the
mptest.py worked, so I guess at least the installation was succesful.

Thanks!




More information about the Mod_python mailing list