Using PIL with py2exe

david.g.morgenthaler at david.g.morgenthaler at
Mon Dec 15 03:38:15 CET 2003

On Wed, 10 Dec 2003 16:04:41 +0000, John Carter <jnc at>

>Does anyone know how to embed PIL into a py2exe program.
>As far as I can tell PIL is not finding its plugins for Image I/O,
>they are imported dynamically as required. So I cant load or save
>I tried making a copy of the plugin files to the application
>directory, but I've had no luck in making the code see the files
>I'd be grateful for any suggestion.
>Please e-mail me, as well as posting a reply.
>John Carter
>jnc at

PIL imports the drivers dynamically, so py2exe doesn't find them.
Including these lines should solve your problem.

## Static imports from PIL for py2exe
from PIL import GifImagePlugin
from PIL import JpegImagePlugin

More information about the Python-list mailing list