[mod_python] Can't seem to get mod_python working, please help me

Graham Dumpleton grahamd at dscpl.com.au
Sun Jan 15 20:56:39 EST 2006


Dan Eloff wrote ..
> Ok I tried your suggestions, but I get the "No module named _apache"
> error.

Which is exactly what you do want for when you run Python outside of
Apache and try to load mod_python. Highlighting what Lee said:

  If your PATH is set correctly, you will get the "No module named _apache" error.

The reason is that the "_apache" module is a special dynamically loaded
module which is only imported into Python when the mod_python.dll is
loaded within the context of Apache.

Thus from the command line Python it will never find "_apache". What it
at least shows though is that the mod_python package installed into the
Python installation was found.

So it is back to why when mod_python.dll is loaded into Apache that it
can not find the mod_python package which is installed into the Python
installation.

Again, we get back to my lack of knowledge of Win32 systems. :-(

BTW, I think for 3.3, we really better add some stuff in mod_python
whereby when this sort of problem occurs, we dump all sorts of info
out about what Python is being used, what sys.path is used etc. Would
make thinks a lot easier as far as seeing what is wrong.

Graham

> I modified the path earlier to add the python directory, which
> enabled the module to load (previously it couldn't find python24.dll)
> I added the site-packages directory as well, but no effect. I don't
> know how to change the permissions, but I installed apache as the user
> I am now, and there are only two users on this computer, both with
> full admin priveledges. Besides which apache loads php just fine (I
> also commented the lines regarding php out but it had no effect)
> 
> I also started up the interpreter and checked sys.path, it had a lot
> of entries in there, including of course the site-packages directory
> and the htdocs directory.
> 
> I'm rather baffled now as to why it won't work.
> 
> Thanks,
> -Dan
> 
> On 1/15/06, Lee Brown <administrator at leebrown.org> wrote:
> > Greetings!
> >
> > I think Graham is right; you could have either a path problem or a
> > user/permission problem.
> >
> > First, make sure that both the directory for the python interpreter and
> the
> > directory where mod_python was installed are available in the PATH
> > environment variable.  Open a new command prompt window in whatever
> > directory your mptest.py resides and execute "python mptest.py"  If your
> > PATH is set correctly, you will get the "No module named _apache" error.
> If
> > you get "No module named mod_python" then the interpreter path is fine,
> but
> > you need to put mod_python.py where the interpreter can find it.
> >
> > Next, temporarily set the permissions on the Python root directory to
> grant
> > full control to everyone.  Restart your Apache server and see if that
> fixes
> > the problem.  If it does, set the permissions of the Python root directory
> > to grant full control to whatever user the Apache process is running
> as.
> >
> > If none of this helps, give us a holler back and let us know what happened.
> >
> > Best Regards,
> > Lee E. Brown
> > (administrator at leebrown.org)
> >
> > -----Original Message-----
> > From: mod_python-bounces at modpython.org
> > [mailto:mod_python-bounces at modpython.org] On Behalf Of Dan Eloff
> > Sent: Sunday, January 15, 2006 5:32 PM
> > To: mod_python at modpython.org
> > Subject: [mod_python] Can't seem to get mod_python working, please help
> me
> >
> > I installed mod_python on my XP pro system with apache 2.0.55 and python
> > 2.4.2 I get an internal server error when trying to load any .py
> >
> > I added this to the bottom of my conifg file, and added the load module
> > statement as well.
> >
> > <Directory />
> >         AddHandler mod_python .py
> >         PythonHandler mptest
> >         PythonDebug On
> > </Directory>
> >
> > The module seems to be loading correctly. mod_python also seems to be
> > installed correctly, when I try and import mod_python from an interpreter
> it
> > says it can't find _apache.
> >
> > The relevant lines from the log file are pasted below. The url I try
> to
> > access is localhost/test.py, which doesn't exist, but I don't think that
> > matters to mod_python, it will try to handle it anyway, but never seems
> to
> > get that far.
> >
> > What are some things I should check or some things I can try to get it
> > working?
> >
> > Thanks,
> > -Dan
> >
> > [Sun Jan 15 13:53:32 2006] [notice] Apache/2.0.55 (Win32) mod_python/3.2.2b
> > Python/2.4.2 PHP/5.1.1 configured -- resuming normal operations [Sun
> Jan 15
> > 13:53:32 2006] [notice] Server built: Oct  9 2005 19:16:56 [Sun Jan 15
> > 13:53:32 2006] [notice] Parent: Created child process 2716 [Sun Jan 15
> > 13:53:32 2006] [notice] mod_python: Creating 8 session mutexes based
> on 0
> > max processes and 10 max threads.
> > [Sun Jan 15 13:53:32 2006] [notice] Child 2716: Child process is running
> > [Sun Jan 15 13:53:32 2006] [notice] Child 2716: Acquired the start mutex.
> > [Sun Jan 15 13:53:32 2006] [notice] Child 2716: Starting 10 worker threads.
> > [Sun Jan 15 13:57:02 2006] [error] make_obcallback: could not import
> > mod_python.apache.\n [Sun Jan 15 13:57:02 2006] [error] python_handler:
> no
> > interpreter callback found.
> > [Sun Jan 15 13:57:02 2006] [error] [client 127.0.0.1] python_handler:
> > Can't get/create interpreter.
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> >
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list