[mod_python] Apache Virtual Host and mod-python error

Tonu Mikk tmikk at umn.edu
Tue Oct 23 11:14:43 EDT 2007

Thanks for your replies!  I commented out the offending line and all is 
working well now.  See below my original config. 

Graham Dumpleton wrote:
> On 20/10/2007, Tonu Mikk <tmikk at umn.edu> wrote:
>> I am getting an error when using Apache (v 2.0) Virtual Host and
>> Mod-python (v3.2.10).
>> Mod_python error: "PythonHandler roundup.cgi.apache"
>> Traceback (most recent call last):
>>  File "C:\Python24\lib\site-packages\mod_python\apache.py", line 276, in
>> HandlerDispatch
>>    newpath = eval(pathstring)
>>  File "", line 1
>>    /Python24/python.exe
>>    ^
>> SyntaxError: invalid syntax
>> When I refresh the page, the error disappears, and the page is
>> displayed.  The error tends to happen consistently when I re-start
>> Apache service and go to the page for the first time.  I have modified
>> the line in Virtual host directive to be C:/Python24/python.exe, but the
>> same behavior happens.
> What line? There should never be a need with mod_python to list the
> path of the Python executable in the Apache configuration.
The offending line was
PythonPath      C:/Python24/python.exe

> As someone else mentioned, post your snippet of Apache configuration
> where you setup your mod_python handler. Don't post the whole
> configuration, just the relevant snippet.
> Graham
<VirtualHost mydomain.domain.rootdomain>
        ServerName      mydomain.domain.rootdomain
        ServerAdmin     me at mydomain.domain.rootdomain

        AliasMatch ^/@@file(.*) C:/roundup/tracker/html$1
        AliasMatch ^/([email protected]@file)(.*) C:/roundup/tracker/html/dummy.py/$1

        DocumentRoot    C:/roundup/tracker/html
        <Directory      C:/roundup/*>
                # UMN only IP access
                AllowOverride None
                Options None
                Order allow,deny

        AddHandler      python-program .py
        PythonOptimize  On
#        PythonPath      C:/Python24/python.exe
        PythonHandler   roundup.cgi.apache
        PythonOption    TrackerHome     /roundup/tracker

More information about the Mod_python mailing list