List Info

Thread: Problem using PIL with cx_freeze




Problem using PIL with cx_freeze
user name
2006-11-21 02:06:18
Fredrik Lundh wrote:

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:

     http:/
/www.py2exe.org/index.cgi/PIL_and_py2exe
------------------------------------------------------------
-----

Thanks Fredrik, that helped me get the software to run after
freezing.

However I have one remaining inexplicable difference when I
run the
frozen software in two different VMWare environments.

Environment 1:  Win2K (SP4), python2.3.5,
pywin32-210.win32-py2.3,
PIL-1.1.5.win32-py2.3, pilwmf-1.0b2-20040224.win32-py2.3 and
cx_Freeze-3.0.3-win32-py23.

Environemnt 2:  Win2K (SP4).

I have built and frozen the image in environment 1 and then
copied the
frozen software across to environment 2. When I run the
program two
different PNG images are created? The image is a chart
product which has
coastal outlines, various symbols, labels and
latitude/longitude grids
as a series of points. Upon visual examination the Env2
image is the
same as the Env1 image except for the lat/long grid
"points" (small
solid dots).

I suspect that there is something else from within the PIL
library that
it is using. I ran the unfrozen code interactively in Env1
with the "-v"
command line option to see what modules are called. I have
included all
the dynamically-loaded .pyd modules into the freeze output
directory and
imported all those within PIL that are mentioned; as
follows:

import Image
import WmfPlugin
import PngImagePlugin, ImagePalette, ImageFile
import BmpImagePlugin, GifImagePlugin, JpegImagePlugin
import PpmImagePlugin, TiffImagePlugin

Previously I had tried "from PIL import *" but
that did not seem to
help.

Any further thoughts on what is missing would be
appreciated.

Thanks

Colin Brown
PyNZ

_______________________________________________
Image-SIG maillist  -  Image-SIGpython.org
htt
p://mail.python.org/mailman/listinfo/image-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )