I'm not sure anyone has confirmed for me that WSGIPythonHome actually
works on Windows. Windows does strange things.
The use of a single backward slash could be an issue as gert pointed
out, although to follow what Python possible expects, may need to be:
WSGIPythonHome C:\\pythonenv\\BASELINE
Even if that were the problem, if Python was paying attention to it,
it would most likely have died rather than fallback to some default
calculated from where the Windows registry.
Maybe Adal can comment, as I am not a Windows person.
Graham
Use of WSGIPythonHome was only if you wanted to create a base line
Python which was isolated from your standard installed version. This
was always optional, and as long as there are no conflicting package
requirements with your virtual environment you don't need to use it.
So, just use site.addsitedir() or WSGIPythonPath as appropriate for
the version of mod_wsgi and should all still work anyway.
Graham
That is because I rely on you to test things on Windows for me. ;-)
If you get a chance and can work out what is wrong with the
instructions and let me know, would be much appreciated.
Graham
Does the directory you are setting WSGIPythonHome to contain:
lib\\os.py
and can you actually give a list of what is in the directory?
According to PC/getpathp.c in Python source code, it does supposedly
still take PYTHON_HOME into account, but hard to work out what the
code is actually doing.
Graham
It seems that PYTHONHOME has a totally different meaning on Windows
than UNIX boxes. On Windows it seems the only thing it is used for is
to resolve where relative URLs in PYTHONPATH are rooted at.
if (p[0] == '.' && is_sep(p[1])) {
strcpy(buf, pythonhome);
buf = strchr(buf, '\0');
p++;
n--;
}
It would also seem on Windows that everything is based off where the
Python DLL is located and that cannot be overridden through
configuration that mod_wsgi could set.
My question then is, in a Windows virtualenv, does it copy into the
virtualenv the Python DLL? If it does, the alternative to
WSGIPythonHome on Windows is probably to ensure that the Apache
service is started up with PATH with the directory the virtualenv
Python DLL is located in being before anything else. Presuming that is
that searching PATH is how it is found in the first place.
Windows people please help me here. How does one make Apache see the
Python DLL in the virtualenv first?
Graham
FWIW, all the speculation in that discussion was based on me having to
interpret second hand information sent to me by others. Usually those
people didn't know what to look for and could well not have been doing
the correct thing or interpreting the result properly. Part of the
feedback could also have been based on older versions of Python which
possibly may not have worked in exactly the same way for all I know.
It is only recently that I have started building mod_wsgi myself on
Windows and even then I don't really test it on Windows much. Now that
I have the environment, I am in a position to properly research this
issue however, so I will create a ticket to do that. I am not sure
though whether changes will be made for mod_wsgi 3.0 however, depends
on how much time I have.
> Incidentally, I've noticed in this thread a lot of people are
> referencing log output like this:
>
> [Tue Jan 15 16:48:57 2008] [warn] mod_wsgi: Python module path 'C:\
> \WINDOWS\\system32\\python25.zip;C:\\Python25\\Lib;C:\\Python25\
> \DLLs;C:\\Python25\\Lib\\lib-tk;;C:\\Program Files\\Apache Software
> Foundation\\Apache2.2\\bin'.
>
> That output is produced by wsgi_python_version, which is called before
> Py_SetPythonHome; so how could it ever reflect WSGIPythonHome?
Later versions of mod_wsgi than you are using don't output that any
more as it is mostly meaningless anyway, even if Python home was
overridden.
PS. I have sent this back onto list with bcc to you in case you don't
want your details public given you sent me this direct.
Graham
This is reenabled in 3.0 trunk. Don't have time nor inclination (cause
I find it ugly working on Windows), to do any real tests of it. I got
as far as setting WSGIPythonHome to C:/cygwin/../Python26 and it still
work but with that value reflected in sys.prefix. It only crashed in
shutdown when I tried referring it to a Python 3.0 installation
instead. :)
Graham