[mod_python] Re: mod_python and C extensions

argriffi argriffi at ncsu.edu
Wed Feb 20 12:23:19 EST 2008

Hi guys,

I'm having a problem getting Apache and mod_python to use my C extension 
module mymodule.so instead of my raw python module mymodule.py.  Both 
modules have been tested outside of Apache/mod_python.

There is no error when I have mymodule.py in the directory, but when I 
replace it with mymodule.so (in the same directory), I get an error.  
This seems to rule out problems with the python path.

The .py and .so modules that I have tried both have the same owner and 
group, and have the same permissions except that the .so file has 
execute permissions.  This seems to rule out problems with Apache user 

I tried some stuff from googling and from BasicsOfModuleImporting and 
ModuleImportingIsBroken, but I've had no luck and I'm about to start 
using CherryPy or something.


Graham Dumpleton wrote:
> Can you please use the mod_python mailing list to ask questions.
>   http://mailman.modpython.org/mailman/listinfo/mod_python
> Your problem though sounds like you need to either set PythonPath, or
> the file, or directories it is in are not readable to the user that
> Apache runs as.
> Graham
>> Hi,
>> I'm using mod_python to provide some web apps, and I recently rewrote
>> mymodule.py as the C extension mymodule.so.  I was glad to see that it
>> runs about 100x as fast, but I was unhappy to see that it apparently
>> cannot be imported when I am using mod_python.  I get the ImportError
>> "No module named mymodule".  Since I seem to fail at googling, do you
>> have any tips to help me solve this?

More information about the Mod_python mailing list