On Tuesday, December 17, 2002, at 03:03 PM, Tim Wilson wrote:
I'm fairly new to Zope, and am looking for a Product to use on my site for displaying photos. These are mostly personal photos, so I don't have any special needs; just something that will display an index and basic navigation.
Try the Photo product. http://www.zope.org/Members/rbickers/Photo
OK, I've followed the directions, and installed PIL. The installation went without incident, but when I try to view a Photo/PhotoFolder, I get the error message" Error Type: NameError Error Value: global name 'PIL' is not defined I've read what I can on the web and in the docs, and it seems that the Python version running Zope can't access PIL. What's the trick to get PIL available to Zope's Python? ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
perhaps this will be of help: http://www.zope.org/Members/regebro/PIL_zope <--> george donnelly - http://zettai.net/ - "We Love Newbies" :) Zope Hosting - Dynamic Website Design - Search Engine Promotion Yahoo, AIM: zettainet - ICQ: 51907738 - e:george@zettai.net
From: Ed Leafe <ed@leafe.com> Date: Mon, 23 Dec 2002 17:23:51 -0500 To: <zope@zope.org> Cc: Tim Wilson <wilson@visi.com> Subject: Re: [Zope] Photo browsing products for Zope
On Tuesday, December 17, 2002, at 03:03 PM, Tim Wilson wrote:
I'm fairly new to Zope, and am looking for a Product to use on my site for displaying photos. These are mostly personal photos, so I don't have any special needs; just something that will display an index and basic navigation.
Try the Photo product. http://www.zope.org/Members/rbickers/Photo
OK, I've followed the directions, and installed PIL. The installation went without incident, but when I try to view a Photo/PhotoFolder, I get the error message"
Error Type: NameError Error Value: global name 'PIL' is not defined
I've read what I can on the web and in the docs, and it seems that the Python version running Zope can't access PIL. What's the trick to get PIL available to Zope's Python?
___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Monday, December 23, 2002, at 03:23 PM, george donnelly wrote:
perhaps this will be of help:
Yes, it helped. I'm getting further now. I got to the point where I went to test it in Python. I don't have Tcl/TK installed on my machine, so I commented out the sections in Makefile and Setup as instructed. But when I run the Python test, I get the following: Python 2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "copyright", "credits" or "license" for more information.
import PIL.Image a=PIL.Image.open('Images/lena.jpg') a.load() Traceback (most recent call last): File "<stdin>", line 1, in ? File "PIL/ImageFile.py", line 126, in load self.load_prepare() File "PIL/ImageFile.py", line 180, in load_prepare self.im = Image.core.new(self.mode, self.size) File "PIL/Image.py", line 39, in __getattr__ raise ImportError, "The _imaging C module is not installed" ImportError: The _imaging C module is not installed
Seems to me that just commenting out the Tk stuff didn't work - it still can't find the right image processing module. Do I have to install Tk, or is there some other reason for this error that I can correct? ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
From: "Ed Leafe" <ed@leafe.com>
Seems to me that just commenting out the Tk stuff didn't work - it still can't find the right image processing module.
No, it can't find PIL at all. Probably the compile failed, or you aren't in the directory where _imaging.so is.
On Thursday, December 26, 2002, at 04:08 AM, Lennart Regebro wrote:
Seems to me that just commenting out the Tk stuff didn't work - it still can't find the right image processing module.
No, it can't find PIL at all. Probably the compile failed, or you aren't in the directory where _imaging.so is.
It seems to be finding PIL, since it seems to not squawk when PIL.Image.open() is called. And I'm running this from the same directory that PIL is built from. I've been trying various other things after Googling a bit, and now I get the following message when try the sample code: Python 2.2.1 (#1, Aug 30 2002, 12:15:30) [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import PIL.Image a = PIL.Image.open('Images/lena.jpg') a.load() Traceback (most recent call last): File "<stdin>", line 1, in ? File "PIL/ImageFile.py", line 140, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 255, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available
I followed the instructions on the "Using PIL with Zope" page (http://www.zope.org/Members/regebro/PIL_zope), and configured the imaging lib with the correct paths to zlib and jpeglib, and the message now seems to be getting closer. Does anyone know why PIL can't find the decoder? ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
Ed Leafe wrote at 2002-12-30 21:08 -0500:
,,, I've been trying various other things after Googling a bit, and now I get the following message when try the sample code:
Python 2.2.1 (#1, Aug 30 2002, 12:15:30) [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import PIL.Image a = PIL.Image.open('Images/lena.jpg') a.load() Traceback (most recent call last): File "<stdin>", line 1, in ? File "PIL/ImageFile.py", line 140, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 255, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available The error message is very clear: PIL lacks the "jpeg" decoder.
Modern PIL versions lack this decoder only when the jpeg library was missing when PIL was installed. Please read the PIL installation instructions about the prerequisite libraries, PIL needs for full support. Dieter
On Wednesday, January 1, 2003, at 02:46 PM, Dieter Maurer wrote:
Traceback (most recent call last): File "<stdin>", line 1, in ? File "PIL/ImageFile.py", line 140, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 255, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available The error message is very clear: PIL lacks the "jpeg" decoder.
Modern PIL versions lack this decoder only when the jpeg library was missing when PIL was installed.
Please read the PIL installation instructions about the prerequisite libraries, PIL needs for full support.
Sorry, I guess I wasn't clear enough. I followed those instruction originally, and got errors. I posted them here, and was referred to the page http://www.zope.org/Members/regebro/PIL_zope for additional information. I followed those steps exactly, including the tests for the jpeg library and the corresponding changes to the Makefile when compiling PIL. After these additional steps, I got the errors I noted above. My question was why, even *after* following the steps to ensure that the jpeglib was correctly installed and verifying that the library is indeed in /usr/local/lib, PIL is still not able to find/use it. ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
Am 01.01.2003, 22:57 Uhr schrub Ed Leafe <ed@leafe.com>:
File "PIL/Image.py", line 255, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available
My question was why, even *after* following the steps to ensure that the jpeglib was correctly installed and verifying that the library is indeed in /usr/local/lib, PIL is still not able to find/use it.
If you go to PIL/Image.py and examine the code directly preceding line 255 you will notice that in line 251 PIL tries to getattr(attr(core,decoder_name + "_decoder")) and subsequently apply(decoder, (mode,) + args + extra) So there are obviously two points where this try/except may fail: Either the decoder isn't available at all or the following apply-clause fails. If you go back to line 48 of Image.py there's another try/except where PIL imports _imaging. As the corresponding failure case inevitably returns an exception with the string "The _imaging C module is not installed" we can conclude that you actually have some _imaging.so installed. You could try to "import _imaging" manually and print "_imaging.__file__" to find out if the correct _imaging.so is imported. If you successfully imported _imaging you can "dir(_imaging)" and check if "jpeg_decoder" is an element of the resulting list. If you have multiple _imaging.so-Files on your system try experimenting with sys.path to find out, which _imaging.so is actually imported for Zope. Jo. -- Internetmanufaktur Jo Meder ---------------------- Berlin, Germany http://www.meder.de/ ------------------- fon: ++49-30-417 17 63 33 Kollwitzstr. 75 ------------------------ fax: ++49-30-417 17 63 45 10435 Berlin --------------------------- mob: ++49-170- 2 98 89 97 Public GnuPG-Key ---------- http://www.meder.de/keys/jo-pubkey.txt
Ed Leafe schrieb:
OK, I've followed the directions, and installed PIL. The installation went without incident, but when I try to view a Photo/PhotoFolder, I get the error message"
Error Type: NameError Error Value: global name 'PIL' is not defined
I've read what I can on the web and in the docs, and it seems that the Python version running Zope can't access PIL. What's the trick to get PIL available to Zope's Python?
Just two quite obvious questions: - Did you install PIL in the Python version your Zope uses? - Can you import PIL from the console of that version? If not, check why and/or post the errors here... Martin
On Monday, December 23, 2002, at 06:09 PM, Martin Gebert wrote:
Just two quite obvious questions:
- Did you install PIL in the Python version your Zope uses?
I guess not, since it doesn't seem to be working. I figured that's what I did wrong; I just don't know how to tell PIL to install itself in a particular place. And yes, I read the docs on the web and in the source, I just must have missed it.
- Can you import PIL from the console of that version?
Not if I run [zopedir]/bin/python. If I run the /usr/bin/python instead, I can import w/o problem.
If not, check why and/or post the errors here...
[root@marge 2-6-0]# ./bin/python Python 2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "copyright", "credits" or "license" for more information.
import _imaging Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named _imaging
___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://foxcentral.net
--On 23 December 2002 19:08 -0500 Ed Leafe <ed@leafe.com> wrote:
Not if I run [zopedir]/bin/python. If I run the /usr/bin/python instead, I can import w/o problem.
If not, check why and/or post the errors here...
[root@marge 2-6-0]# ./bin/python Python 2.1.3 (#1, Sep 19 2002, 13:15:46) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "copyright", "credits" or "license" for more information.
import _imaging Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named _imaging
You've got a problem with the environment variables used by [zopedir]/bin/python. One way of working round this is to edit your start script in [zopedir] so Zope uses /usr/bin/python. This may break other things though. Paul -- The Library, Tyndall Avenue, Univ. of Bristol, Bristol, BS8 1TJ, UK E-mail: paul.browning@bristol.ac.uk URL: http://www.bris.ac.uk/
participants (7)
-
Dieter Maurer -
Ed Leafe -
george donnelly -
Jo Meder -
Lennart Regebro -
Martin Gebert -
Paul Browning