PIL and py2exe Issues

Anand Pillai pythonguy at Hotpop.com
Thu Jun 5 14:21:53 CEST 2003

I had faced similar problems sometime back . 
What you need to do is perform a separate import
of the image plugin modules which you need in your
program before you process it using PIL.

i.e, instead of just
import Image

you need to add

import JpegImagePlugin    #for jpeg
import TgaImagePlugin     #for tga
import PngImagePlugin     #for png

You need to do this for each image plugin you need
PIL support for. (This question has been asked manytimes
in this group before, I myself have asked it a couple of 

You can take a look at PyWiew source code in my homepage
for details.


Anand Pillai


kdahlhaus at yahoo.com (Kevin Dahlhausen) wrote in message news:<283adf56.0306041002.4b2d456f at posting.google.com>...
> Anyone come across the problem of PIL not being able to identify image
> files once it's compiled with py2exe?   Do I need to manually add some
> plugins to the setup or something?
> Traceback (most recent call last):
>   File "<string>", line 65, in ?
>   File "<string>", line 31, in __init__
>   File "PictureList.pyc", line 42, in __init__
>   File "PictureInfo.pyc", line 23, in __init__
>   File "Image.pyc", line 1571, in open
> IOError: cannot identify image file
> Versions:
> Python 2.2.2 (#37)
> PIL 1.1.4
> Thanks

More information about the Python-list mailing list