[mod_python] How to make mod_python (Win32) not to rely onregistrykey?

Nicolas Lehuen nicolas at lehuen.com
Tue Jun 27 10:50:02 EDT 2006


I think that's the way to go, because it looks like Python doesn't
like the environment variables set by Apache. I need to investigate
more, but your solution, John, is a sure bet.

Regards,
Nicolas

2006/6/27, John Keyes <john.keyes at secantus.com>:
> I think he can still do it if he launches apache from a batch
> file.  Inside this batch file set the PYTHON_HOME.  This
> is the setup I use for an application I need to distribute
> across machines, but do not want to make the installer
> more complicated than a basic unzip.
>
> Here's an example batch file that I use:
>
> == SOF ==
> setlocal
>
> set PATH=C:\Python;%PATH%
> set PYTHONHOME=C:\Python
>
> start "c:\Apache\bin\apache.exe
>
> endlocal
> == EOF ==
>
> -John K
>
> Graham Dumpleton wrote:
> > For what he was trying to do, this was not an option. See:
> >
> >   http://www.modpython.org/pipermail/mod_python/2006-June/021453.html
> >   http://www.modpython.org/pipermail/mod_python/2006-June/021456.html
> >
> > In short, he wants to be able to run stuff off a USB drive and avoid
> > having to make modifications to the Win32 registry or anywhere'
> > else outside of the Apache configuration itself.
> >
> > I unfortunately don't know anything about how Python is configured
> > on Win32 so it knows where to find things.
> >
> > If anyone else has suggestions, would be appreciated.
> >
> > Graham
> >
> > John Keyes wrote ..
> >> Sanja,
> >>
> >> Try setting the PYTHON_HOME environment variable:
> >>    set PYTHON_HOME=c:/Python24
> >>
> >> -John K
> >>
> >> Graham Dumpleton wrote:
> >>> sanja at bougakov.com wrote ..
> >>>> Hello, Graham,
> >>>>
> >>>> The problem is that adding the
> >>>>
> >>>>    PythonPath "sys.path +
> >>>> ['C:/Python24/Lib','C:/Python24/Lib/mod_python','C:/Python24/DLLs','C:/Python24/Lib/lib-tk']"
> >>>>
> >>>> line in httpd.conf doesn't help - I still get the
> >>>>
> >>>>   [Mon Jun 26 15:56:04 2006] [error] [client 127.0.0.1] python_handler:
> >>>>   make_obcallback returned no obCallBack!
> >>>>
> >>>> in Apache's error.log file. But when I restore the
> >>>> HKCU\Software\Python\PythonCore\2.4\PythonPath Registry hive and restart
> >>>> Apache, everything works OK.
> >>> I don't know what happens on Win32, but on UNIX mod_python gets
> >>> installed in a 'site-packages' directory and the 'site-packages'
> >>> directory only would be in sys.path, and not the mod_python package
> >>> directory.
> >>>
> >>> Where is the mod_python package installed?
> >>>
> >>> Does the user which Apache runs as have permission to read the stuff
> >> in
> >>> the mod_python package directory?
> >>>
> >>> Can people who know Win32 better than I help out at this point.
> >>>
> >>> Graham
> >>>
> >>>>> The SetEnv directive only affects environment variables inherited by
> >>>>> CGI scripts. It does not affect the environment of Apache itself and
> >>>>> thus does not affect the environment of mod_python. In order to add
> >>>>> extra directories into the Python module search path, use the
> >>>>> PythonPath directive as documented in the mod_python documentation.
> >>>>> Graham
> >>>>> On 23/06/2006, at 8:00 PM, sanja at bougakov.com wrote:
> >>>>>> The problem is that mod_python doesn't look at these env.
> >>>>>> variables. It checks only HKCU\Software\Python registry hive.
> >>>>>> If I remove it and restart Apache, I get "error 500".
> >>>> _______________________________________________
> >>>> 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
> >>>
> >
> _______________________________________________
> 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