How does mod_python know where's Python installed ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • arorap

    #1

    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.

  • Graham Dumpleton

    #2
    Re: How does mod_python know where's Python installed ?

    On Jun 13, 7:03 am, arorap <aro...@gmail.c omwrote:
    Hi,
    >
    I recently setupmod_python successfully and things work smooth.
    However, I do not remember tellingmod_pyth onwhere to find Python
    installation. There's not environment variable which gives that
    information. As such how doesmod_pythonk now 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:



    for further details in respect of that problem.

    Graham


    Comment

    Working...