[Tutor] mod_python and PIL?
marilyn at deliberate.com
Tue Apr 13 20:49:41 EDT 2004
Thank you Danny.
On Tue, 13 Apr 2004, Danny Yoo wrote:
> On Tue, 13 Apr 2004, Marilyn Davis wrote:
> > I just upgraded to 2.3.3 and I put in PIL and made a mod_python for
> > Apache. But when I run my script as a cgi, it can't import Image. When
> > I run it directly, it finds Image just fine. In fact, all my (many)
> > resident versions of python find Image.
> > So what could be wrong?
> Hi Marilyn,
> It sounds like you may have multiple versions of Python installed. The
> PATH that the mod_python programs are running under may be different than
> the one in your current environment. Can you check to see if you can
> change which Python is running for mod_python?
It's still the old mod_python because I forgot to "apachectl restart".
But doing so tells me:
Cannot load /www/libexec/mod_python.so into server: /www/libexec/mod_python.so: undefined symbol: pthread_sigmask
And I'm stumped. For python2.3.3:
[root at maildance mod_python-2.7.8]# cd ../Python-2.3.3
[root at maildance Python-2.3.3]# ./configure --with-threads=no
much deleted ...
*** WARNING: renaming "_testcapi" since importing it failed: build/lib.linux-i686-2.3/_testcapi.so: undefined symbol: PyGILState_Ensure
*** WARNING: renaming "_bsddb" since importing it failed: build/lib.linux-i686-2.3/_bsddb.so: undefined symbol: PyGILState_Ensure
*** WARNING: renaming "zlib" since importing it failed: build/lib.linux-i686-2.3/zlib.so: undefined symbol: PyThread_acquire_lock
*** WARNING: renaming "bz2" since importing it failed: build/lib.linux-i686-2.3/bz2.so: undefined symbol: PyThread_acquire_lock
*** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-i686-2.3/_tkinter.so: undefined symbol: PyThread_acquire_lock
[root at maildance Python-2.3.3]#
So I guess that means that threads aren't happening?
I notice, though, that when I "python2.3 setup.py build" to make PIL,
I get lots like this:
[root at maildance Imaging-1.1.4]# python2.3 setup.py build
gcc -pthread -shared build/temp.linux-i686-2.3/_imaging.o build/temp.linux-i686-2.3/decode.o build/temp.linux-i686-2.3/encode.o build/temp.linux-i686-2.3/map.o build/temp.linux-i686-2.3/display.o build/temp.linux-i686-2.3/outline.o build/temp.linux-i686-2.3/path.o -LlibImaging -lImaging -ljpeg -lz -o build/lib.linux-i686-2.3/_imaging.so
building '_imagingtk' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include/python2.3 -c Tk/tkImaging.c -o build/temp.linux-i686-2.3/Tk/tkImaging.o
So I see that -pthread and wonder if that's what's causing it.
But this is seeming too hard. I can't help thinking that I'm doing
something wrong from the start.
> > Is there a way to find out for sure which version of python is running?
> > Can I output the version number?
> Yes. Here you go:
> >>> import sys
> >>> print sys.version
> 2.2.1 (#1, Sep 3 2002, 14:52:01)
> [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)]
> Good luck to you.
More information about the Tutor