Python Image Library IOError - cannot find JPEG decoder?

wongobongo wongo888 at gmail.com
Wed Feb 25 11:17:33 CET 2009


On Feb 24, 9:34 am, Dario Traverso <traver... at gmail.com> wrote:
> I've been trying to install the Python Image Library  (PIL) on my Mac  
> OSX Leopard laptop, but have been running into some difficulties.
>
> I've built the library, using the included setup.py  script. The build  
> summary checks out ok, and sounds the option libraries to all be  
> found. I grabbed both libjpeg and freetype2  using  fink.
>
> --------------------------------------------------------------------
> PIL 1.1.6 BUILD SUMMARY
> --------------------------------------------------------------------
> version       1.1.6
> platform      darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
>               [GCC 4.0.1 (Apple Inc. build 5465)]
> --------------------------------------------------------------------
> --- TKINTER support ok
> --- JPEG support ok
> --- ZLIB (PNG/ZIP) support ok
> --- FREETYPE2 support ok
> --------------------------------------------------------------------
>
> However,  I then run the included self test, and 1 out of 57 tests  
> fails. I receive an IOError. Specifically:
>
> *****************************************************************
> Failure in example: _info(Image.open("Images/lena.jpg"))
> from line #24 of selftest.testimage
> Exception raised:
> Traceback (most recent call last):
>   File "./doctest.py", line 499, in _run_examples_inner
>     exec compile(source, "<string>", "single") in globs
>   File "<string>", line 1, in <module>
>   File "./selftest.py", line 22, in _info
>     im.load()
>   File "PIL/ImageFile.py", line 180, in load
>     d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
>   File "PIL/Image.py", line 375, in _getdecoder
>     raise IOError("decoder %s not available" % decoder_name)
> IOError: decoder jpeg not available
> 1 items had failures:
>    1 of  57 in selftest.testimage
> ***Test Failed*** 1 failures.
> *** 1 tests of 57 failed.
>
> I've followed all of the installation instructions exactly. The build  
> summary reported everything was "ok". What could be the problem here.  
> Libjpeg-6b  is not accessible?
>
> Thank you for any insight you can provide!!
>
> -Dario


That would be my guess.

Two things you may want to try:

1. Check that your Fink libraries and headers were used to make your
PIL (check -I and -L settings on gcc after doing "python setup.py
build_ext -i"). They should point to your Fink lib and include dirs.
2. Line 372 in PIL/Image.py has a debug print line. Try uncommenting
that and see what comes out.

That might give you some clues as to what is going on. You can always
just call up Python in a terminal and try it out (from selftest.py
doctests beginning on line 29).

>>> import Image
>>> def _info(im):
...    im.load()
...    return im.format, im.mode, im.size
>>> im = Image.new("1", (128, 128))
>>> _info(im)
(None, '1', (128, 128))




More information about the Python-list mailing list