On Jan 25, 4:41 pm, Graham Dumpleton <[email protected]>
wrote:
> 2010/1/26 fhuddles <[email protected]>:
>
>
>
>
>
>
>
> > On Jan 24, 5:26 pm, Graham Dumpleton <[email protected]>
> > wrote:
> >> With so many versions installed in so many locations, really hard to
> >> know what is going on.
>
> >> Try this.
>
> >> 1. Create a file called /tmp/testhttpd.sh. In it add the following
> >> except to add the correct location of the Apache httpd for Apache
> >> installation you are using.
>
> >> #/bin/sh
>
> >> PYTHONVERBOSE=1
> >> export PYTHONVERBOSE
>
> >> /usr/sbin/httpd -X
>
> >> 2. Make file executable.
>
> >> chmod +x /tmp/testhttpd.sh
>
> >> 3. Make sure your existing Apache instances are shutdown.
>
> >> apachectl stop
>
> >> 4. Run this test script:
>
> >> sudo /tmp/testhttpd.sh
>
> >> 5. Make request to URL.
>
> >> 6. Kill the test script using Ctrl-C.
>
> >> 7. Check the error logs for that Apache installation and see what you
> >> can find about the path locations that Python is trying to access. For
> >> example:
>
> >> [Mon Jan 25 10:25:50 2010] [notice] mod_python: using mutex_directory /tmp
> >> # installing zipimport hook
> >> import zipimport # builtin
> >> # installed zipimport hook
> >> # 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site­­.pyc
> >> matches 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site­­.py
> >> import site # precompiled from
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site­­.pyc
> >> # 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.p­­yc
> >> matches 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.p­­y
> >> import os # precompiled from
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.p­­yc
> >> import posix # builtin
> >> # 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/posi­­xpath.pyc
> >> matches 
> >> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/posi­­xpath.py
>
> >> 8. Give a sample to show where it is trying to access stuff from.
>
> >> Graham
>
> >> 2010/1/23 fhuddles <[email protected]>:
>
> > OK, here you go. Looks as though its getting its Python from the Fink-
> > installed version at /sw/lib/python*
> > But that's version 2.6.2, and it reports 2.6.4 when it is queried or
> > in the initialization line. 2.6.4 is the MacPython version.
>
> Now try the following in succession.
>
> 1. Set PATH to include where the real 'python' binary is that you want to use:
>
> #/bin/sh
>
> PATH=Library/Frameworks/Python.framework/Versions/2.6/bin:$PATH
> export PATH
>
> PYTHONVERBOSE=1
> export PYTHONVERBOSE
>
> /usr/sbin/httpd -X
>
This did not work:

error log after helloworld:
# /sw/lib/python2.6/warnings.pyc matches /sw/lib/python2.6/warnings.py
import warnings # precompiled from /sw/lib/python2.6/warnings.pyc
# /sw/lib/python2.6/linecache.pyc matches /sw/lib/python2.6/
linecache.py
import linecache # precompiled from /sw/lib/python2.6/linecache.pyc
# /sw/lib/python2.6/types.pyc matches /sw/lib/python2.6/types.py
import types # precompiled from /sw/lib/python2.6/types.pyc
import _warnings # builtin
# /sw/lib/python2.6/UserDict.pyc matches /sw/lib/python2.6/UserDict.py
import UserDict # precompiled from /sw/lib/python2.6/UserDict.pyc
# /sw/lib/python2.6/_abcoll.pyc matches /sw/lib/python2.6/_abcoll.py
import _abcoll # precompiled from /sw/lib/python2.6/_abcoll.pyc
# /sw/lib/python2.6/abc.pyc matches /sw/lib/python2.6/abc.py
import abc # precompiled from /sw/lib/python2.6/abc.pyc
# /sw/lib/python2.6/copy_reg.pyc matches /sw/lib/python2.6/copy_reg.py
import copy_reg # precompiled from /sw/lib/python2.6/copy_reg.pyc
[Tue Jan 26 10:59:19 2010] [info] mod_wsgi (pid=2172): Create
interpreter 'localhost|/helloworld'.
[Tue Jan 26 10:59:19 2010] [error] import signal # previously loaded
(signal)
[Tue Jan 26 10:59:19 2010] [info] [client 127.0.0.1] mod_wsgi
(pid=2172, process='', application='localhost|/helloworld'): Loading
WSGI script '/usr/local/apps/test/helloworld.wsgi'.
[Tue Jan 26 10:59:19 2010] [error] # /sw/lib/python2.6/socket.pyc
matches /sw/lib/python2.6/socket.py
[Tue Jan 26 10:59:19 2010] [error] import socket # precompiled from /
sw/lib/python2.6/socket.pyc
[Tue Jan 26 10:59:19 2010] [error] dlopen("/sw/lib/python2.6/lib-
dynload/_socket.so", 2);
Fatal Python error: Interpreter not initialized (version mismatch?)
[iota:~] fhuddles%

-- and on the command line from which I'd run the testhttpd.sh script:

./testhttpd.sh: line 8:  2172 Abort trap              /sw/sbin/apache2
-X
[iota:local/apps/test] fhuddles%
> 2. Try overriding PYTHONEXECUTABLE.
>
> #/bin/sh
>
> PYTHONEXECUTABLE=/Library/Frameworks/Python.framework/Versions/2.6/bin/pyth­on
> export PYTHONEXECUTABLE
>
> PYTHONVERBOSE=1
> export PYTHONVERBOSE
>
> /usr/sbin/httpd -X
>
This didn't work either:

end of error log:
# /sw/lib/python2.6/_abcoll.pyc matches /sw/lib/python2.6/_abcoll.py
import _abcoll # precompiled from /sw/lib/python2.6/_abcoll.pyc
# /sw/lib/python2.6/abc.pyc matches /sw/lib/python2.6/abc.py
import abc # precompiled from /sw/lib/python2.6/abc.pyc
# /sw/lib/python2.6/copy_reg.pyc matches /sw/lib/python2.6/copy_reg.py
import copy_reg # precompiled from /sw/lib/python2.6/copy_reg.pyc
[Tue Jan 26 11:06:51 2010] [info] mod_wsgi (pid=2185): Create
interpreter 'localhost|/helloworld'.
[Tue Jan 26 11:06:51 2010] [error] import signal # previously loaded
(signal)
[Tue Jan 26 11:06:51 2010] [info] [client 127.0.0.1] mod_wsgi
(pid=2185, process='', application='localhost|/helloworld'): Loading
WSGI script '/usr/local/apps/test/helloworld.wsgi'.
[Tue Jan 26 11:06:51 2010] [error] # /sw/lib/python2.6/socket.pyc
matches /sw/lib/python2.6/socket.py
[Tue Jan 26 11:06:51 2010] [error] import socket # precompiled from /
sw/lib/python2.6/socket.pyc
[Tue Jan 26 11:06:51 2010] [error] dlopen("/sw/lib/python2.6/lib-
dynload/_socket.so", 2);
Fatal Python error: Interpreter not initialized (version mismatch?)

On command line:
./testhttpd.sh: line 10:  2185 Abort trap              /sw/sbin/
apache2 -X
[iota:local/apps/test] fhuddles%

> 3. Try overriding PYTHONHOME.
>
> #/bin/sh
>
> PYTHONHOME=/Library/Frameworks/Python.framework/Versions/2.6
> export PYTHONHOME
>
> PYTHONVERBOSE=1
> export PYTHONVERBOSE
>
> /usr/sbin/httpd -X
>
But this one worked! The helloworld script, modified to have the
includes, and the django app ran.

> See if any of those yield the correct paths being used.
>
> If that doesn't help, will need to look at run time library link
> search paths and why fink is taking precedence.
>
> BTW, is the Apache being used from 'fink'? That may cause problem if
> it is forcing search of its library search path first and that is
> overriding normal lookup path.
Yes, the apache2 is from Fink, and is run from /sw/sbin/apache2. All
those python paths that showed up with the verbose flag set were in
/sw/bin, the Fink installation.

>
> Graham
>
> > [Mon Jan 25 11:34:09 2010] [info] mod_wsgi (pid=1559): Initializing
> > Python.
> > # installing zipimport hook
> > import zipimport # builtin
> > # installed zipimport hook
> > # /sw/lib/python2.6/site.pyc matches /sw/lib/python2.6/site.py
> > import site # precompiled from /sw/lib/python2.6/site.pyc
> > # /sw/lib/python2.6/os.pyc matches /sw/lib/python2.6/os.py
> > import os # precompiled from /sw/lib/python2.6/os.pyc
> > import errno # builtin
> > import posix # builtin
> > # /sw/lib/python2.6/posixpath.pyc matches /sw/lib/python2.6/
> > posixpath.py
> > import posixpath # precompiled from /sw/lib/python2.6/posixpath.pyc
> > # /sw/lib/python2.6/stat.pyc matches /sw/lib/python2.6/stat.py
> > import stat # precompiled from /sw/lib/python2.6/stat.pyc
> > # /sw/lib/python2.6/genericpath.pyc matches /sw/lib/python2.6/
> > genericpath.py
> > import genericpath # precompiled from /sw/lib/python2.6/
> > genericpath.pyc
> > # /sw/lib/python2.6/warnings.pyc matches /sw/lib/python2.6/warnings.py
> > import warnings # precompiled from /sw/lib/python2.6/warnings.pyc
> > # /sw/lib/python2.6/linecache.pyc matches /sw/lib/python2.6/
> > linecache.py
> > import linecache # precompiled from /sw/lib/python2.6/linecache.pyc
> > # /sw/lib/python2.6/types.pyc matches /sw/lib/python2.6/types.py
> > import types # precompiled from /sw/lib/python2.6/types.pyc
> > # /sw/lib/python2.6/UserDict.pyc matches /sw/lib/python2.6/UserDict.py
> > import UserDict # precompiled from /sw/lib/python2.6/UserDict.pyc
> > # /sw/lib/python2.6/_abcoll.pyc matches /sw/lib/python2.6/_abcoll.py
> > import _abcoll # precompiled from /sw/lib/python2.6/_abcoll.pyc
> > # /sw/lib/python2.6/abc.pyc matches /sw/lib/python2.6/abc.py
> > import abc # precompiled from /sw/lib/python2.6/abc.pyc
> > # /sw/lib/python2.6/copy_reg.pyc matches /sw/lib/python2.6/copy_reg.py
> > import copy_reg # precompiled from /sw/lib/python2.6/copy_reg.pyc
> > import encodings # directory /sw/lib/python2.6/encodings
> > # /sw/lib/python2.6/encodings/__init__.pyc matches /sw/lib/python2.6/
> > encodings/__init__.py
> > import encodings # precompiled from /sw/lib/python2.6/encodings/
> > __init__.pyc
> > # /sw/lib/python2.6/codecs.pyc matches /sw/lib/python2.6/codecs.py
> > import codecs # precompiled from /sw/lib/python2.6/codecs.pyc
> > import _codecs # builtin
> > # /sw/lib/python2.6/encodings/aliases.pyc matches /sw/lib/python2.6/
> > encodings/aliases.py
> > import encodings.aliases # precompiled from /sw/lib/python2.6/
> > encodings/aliases.pyc
> > # /sw/lib/python2.6/encodings/ascii.pyc matches /sw/lib/python2.6/
> > encodings/ascii.py
> > import encodings.ascii # precompiled from /sw/lib/python2.6/encodings/
> > ascii.pyc
> > [Mon Jan 25 11:34:09 2010] [info] mod_wsgi (pid=1559): Attach
> > interpreter ''.
> > [Mon Jan 25 11:35:24 2010] [info] mod_wsgi (pid=1559): Destroying
> > interpreters.
> > [Mon Jan 25 11:35:24 2010] [info] mod_wsgi (pid=1559): Cleanup
> > interpreter ''.
> > [Mon Jan 25 11:35:24 2010] [error] # /sw/lib/python2.6/threading.pyc
> > matches /sw/lib/python2.6/threading.py
> > [Mon Jan 25 11:35:24 2010] [error] import threading # precompiled
> > from /sw/lib/python2.6/threading.pyc
> > [Mon Jan 25 11:35:24 2010] [error] import thread # builtin
> > [Mon Jan 25 11:35:24 2010] [error] # /sw/lib/python2.6/functools.pyc
> > matches /sw/lib/python2.6/functools.py
> > [Mon Jan 25 11:35:24 2010] [error] import functools # precompiled
> > from /sw/lib/python2.6/functools.pyc
> > [Mon Jan 25 11:35:24 2010] [error] dlopen("/sw/lib/python2.6/lib-
> > dynload/_functools.so", 2);
> > Fatal Python error: Interpreter not initialized (version mismatch?)
>
> >> > On Jan 22, 11:20 pm, Graham Dumpleton <[email protected]>
> >> > wrote:
> >> >> 2010/1/23 fhuddles <[email protected]>:
>
> >> >> > On Jan 22, 4:53 am, Graham Dumpleton <[email protected]>
> >> >> > wrote:
> >> >> >> Is /usr/bin/python still pointing at original Apple Python 2.3 
> >> >> >> version?
> >> >> > Yes; I removed it.
>
> >> >> You should not have removed /usr/bin/python. It must be left as
> >> >> originally supplied by Apple, pointing at Apple Python 2.3. If you
> >> >> remove it or change what it is pointed at, you risk causing any Apple
> >> >> system scripts which depend on it breaking.
>
> >> > OK I put it back. I'm not sure it's exactly the same: I pointed it to
> >> > Current in that directory.
>
> >> >> I'll respond later about the excess of versions you have. You might
> >> >> explain why you have so many different versions and distributions
> >> >> installed.
>
> >> > The Apple versions were just installed with the system, I guess. The
> >> > Fink (/sw) and macports (/opt) ones were mostly installed as
> >> > dependencies of other packages. I don't really know why there are so
> >> > many versions, though: perhaps the packages specified those versions.
> >> > I installed 3.0 at one point, I think from source or binaries
> >> > downloaded from the Python site, and then after having problems using
> >> > 3.0
> >> > with various libraries and other software, I installed the MacPython
> >> > python2.6 via dmg from the Python site.
>
> >> >> Graham
>
> >> >> >> What versions of Python are under 
> >> >> >> /System/Library/Frameworks/Python.framework?
>
> >> >> > ls -l /System/Library/Frameworks/Python.framework/Versions
> >> >> > total 8
> >> >> > drwxr-xr-x   10 root  wheel  340 Dec 11 18:42 2.3
> >> >> > lrwxr-xr-x    1 root  wheel    3 Apr  4  1976 Current -> 2.3
>
> >> >> >> What versions of Python are under 
> >> >> >> /Library/Frameworks/Python.framekwork?
>
> >> >> > ls -l /Library/Frameworks/Python.framework/Versions
> >> >> > total 8
> >> >> > drwxrwxr-x   10 root  admin  340 Oct 27 13:50 2.6
> >> >> > drwxrwxr-x   10 root  admin  340 Mar 15  2009 3.0
> >> >> > lrwxr-xr-x    1 root  admin    3 Nov 26 19:56 Current -> 2.6
>
> >> >> >> Do you have Python installed in any other locations, eg. from fink or
> >> >> >> MacPorts Python under /opt?
>
> >> >> > Yes: from fink, in /sw/bin:
> >> >> > l
> >> >> > s -l /sw/bin/python*
> >> >> > lrwxr-xr-x   1 root  admin        9 May  5  2009 /sw/bin/python ->
> >> >> > python2.6
> >> >> > lrwxr-xr-x   1 root  admin       16 May  5  2009 /sw/bin/python-config
> >> >> > -> python2.6-config
> >> >> > -rwxr-xr-x   1 root  admin  3423412 Nov 13  2008 /sw/bin/python2.4
> >> >> > -rwxr-xr-x   1 root  admin  3913784 May  6  2009 /sw/bin/python2.5
> >> >> > -rwxr-xr-x   1 root  admin     1417 May  6  2009 /sw/bin/python2.5-
> >> >> > config
> >> >> > -rwxr-xr-x   1 root  admin     9816 May  5  2009 /sw/bin/python2.6
> >> >> > -rwxr-xr-x   1 root  admin     1364 May  5  2009 /sw/bin/python2.6-
> >> >> > config
>
> >> >> > I also see this in /opt:
>
> >> >> > ls -l /opt/local/bin/python*
> >> >> > lrwxr-xr-x   1 root  admin  73 Jan 13 14:54 /opt/local/bin/python2.6 
> >> >> > -...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to