Test with mod_wsgi 2.3 and tell me if it does the same thing as
recently did some fiddling with WSGIPythonPath and python-path in
trunk. If you can't go back to 2.3, check out revision 1101 of trunk
instead and try it.
Also, what code is in WSGI script file that:
http://87.98.218.86/appwsgi/www/upload2/upload.py
maps to? In particular, anything that changes sys.path or calls
site.addsitedir().
If you are doing path manipulations in that script file and have used
WSGIApplicationGroup to run lots of scripts in same sub interpreter,
you may have caused an ordering dependency if other script files
import stuff but you have not done similar path change in those script
files.
Also try augmenting scripts with debug which outputs sys.path so you
can show what value it has before and after execution of particular
scripts.
Graham
http://code.google.com/p/modwsgi/issues/detail?id=112
When you use WSGIPythonPath or python-path option, any newly added
directories were added to the end of sys.path. After the change,
sys.path is analysed and newly added directories are shifted in order
as a block from end of sys.path to beginning of sys.path.
The point in doing this is to ensure that newly added directories take
precedence over Python standard module directories and site-packages
directory.
If this is not done, and you don't make main Apache/mod_wsgi use a
virgin virtual environment using WSGIPythonHome, when using per
application/user virtual environments with WSGIPythonPath and
python-path, then the user specific modules can't override main ones.
Note that on Windows WSGIPythonHome doesn't exist and so this was
always a problem there as you could point at virgin virtual
environment.
End result of this may be that if in your new directories added you
have modules with same names as standard modules, they will now
override them. This could be a problem, but then you should be
avoiding name space collisions by not naming modules same as standard
ones.
BTW, this reordering doesn't apply when you cal site.addsitedir() in
the WSGI script file itself.
Also, don't post a dribble of messages containing random thoughts as
you work through it. The important thing at this moment is for you to
dump the value of sys.path into error log and validate that it does at
least have all directories you expect it to for script that is
failing. Also, ensure you also dump out mod_wsgi.process_group and
mod_wsgi.application_group from WSGI environ dictionary and validate
that they are actually correct for where you think code should be
executing and for which WSGIPythonPath or python-path option has been
defined.
Graham
2008/11/3 gert <gert.c...@gmail.com>:
Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c (revision 1105)
+++ mod_wsgi.c (working copy)
@@ -4260,6 +4260,7 @@
module = NULL;
+#if 0
if (!wsgi_daemon_pool) {
module = PyImport_ImportModule("apache");
@@ -4309,6 +4310,7 @@
AP_SERVER_MINORVERSION_NUMBER));
Py_DECREF(module);
+#endif
/*
* Restore previous thread state. Only need to
recompile and tell me if problem goes away.
Also just clarify whether anywhere in your code you actually had:
import apache
Graham
2008/11/3 gert <gert.c...@gmail.com>:
Why do you always make me do the hard work. You should be doing the
hard working in tracking down the problem. ;-(
svn revert mod_wsgi.c
patch -p0 < patch
I ask again, do you have:
import apache
anywhere in your code? I don't want to have to go trolling through
your code myself.
Graham
Does tell me that I am tweaking the right area of the code as now
complains about 'mod_wsgi' module which is just before bit of code I
got you to disable. :-)
No need for you to look further as know now what I probably need to do.
Graham
svn revert mod_wsgi.c
patch -p0 < patchbelow.txt
Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c (revision 1105)
+++ mod_wsgi.c (working copy)
@@ -4201,11 +4201,12 @@
if (module) {
PyErr_Print();
- PyErr_Clear();
PyDict_DelItemString(modules, "mod_wsgi");
}
+ PyErr_Clear();
+
module = PyImport_AddModule("mod_wsgi");
Py_INCREF(module);
@@ -4277,12 +4278,13 @@
Py_END_ALLOW_THREADS
PyErr_Print();
- PyErr_Clear();
PyDict_DelItemString(modules, "apache");
module = NULL;
}
+
+ PyErr_Clear();
}
else {
Py_BEGIN_ALLOW_THREADS
And you probably thought it would be hard to find. I do grant it may
have been hard for you to explain. :-)
Graham
2008/11/3 gert <gert.c...@gmail.com>: