Using PIL with py2exe

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


On Wed, 10 Dec 2003 16:04:41 +0000, John Carter <jnc at ecs.soton.ac.uk>
wrote:

>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
>pictures
>
>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 ecs.soton.ac.uk

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