[Image-SIG] Problem using PIL with cx_freeze

Fredrik Lundh fredrik at pythonware.com
Mon Nov 20 17:42:38 CET 2006

(repost; the original seems to have gotten stuck somewhere)

Colin Brown wrote:

 > I am attempting to put together a package that uses python2.3 under 
the corresponding version of cx_freeze on Windows 2K.

 > When run interactively from python23 it works really well but when 
frozen I get the following error:

 >     Save_handler = SAVE[string.upper(format)] # unknown format
 > KeyError: 'PNG'

PIL uses a dynamic mechanism to load plugins, and freeze tools sometimes 
forget to include the plugins PIL needs.

the easiest way to solve this is to explicitly import the ones you need:

     import Image
     import PngImagePlugin
     import JpegImagePlugin
     # etc

for more on this, see:



More information about the Image-SIG mailing list