471,337 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

How does mod_python know where's Python installed ?

Hi,

I recently setup mod_python successfully and things work smooth.
However, I do not remember telling mod_python where to find Python
installation. There's not environment variable which gives that
information. As such how does mod_python know where to find Python ?
When I print sys.path in my scripts it contains my python installation
folder. I'm wondering how does Apache/mod_python get this
information ?

I'm running Apache 2.2 on windows.
-Puneet.

Jun 12 '07 #1
1 1675
On Jun 13, 7:03 am, arorap <aro...@gmail.comwrote:
Hi,

I recently setupmod_pythonsuccessfully and things work smooth.
However, I do not remember tellingmod_pythonwhere to find Python
installation. There's not environment variable which gives that
information. As such how doesmod_pythonknow where to find Python ?
When I print sys.path in my scripts it contains my python installation
folder. I'm wondering how does Apache/mod_pythonget this
information ?

I'm running Apache 2.2 on windows.
Rather than duplicate here, for a long explanation see the comments in
the file:

Modules/getpath.c

in the Python source code.

In short though, it searches for 'python' executable on PATH and from
that tries to determine where the corresponding 'lib' directory is for
the version of Python that mod_python is linked against.

Because it looks in PATH, this will not always work when people have
multiple versions of Python installed on their system with different
base directories. See:

https://issues.apache.org/jira/browse/MODPYTHON-225

for further details in respect of that problem.

Graham
Jun 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by digidalmation | last post: by
3 posts views Thread by Anthony Papillion II | last post: by
reply views Thread by bruce | last post: by
4 posts views Thread by Gaurav Agarwal | last post: by
113 posts views Thread by John Nagle | last post: by
2 posts views Thread by leland | last post: by
2 posts views Thread by Aaron Scott | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.