[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Mask





Code posted to: http://kschnee.xepher.net/mask_v5.txt
Ah, success.
I discovered what was wrong with your py2exe'ing endeavors.
Lucky for you, eh! ;)

The problem is that PIL, and PMW, and some other modules,
dynamically import what plugins they need at runtime.
so until the program is run, nobody knows that PIL is going to need the PNG plugin,
or the BMP, or JPG, or whatever format, plugin.
So what you do is you explicitly import the plugins at the top of your program.
then you know they'll be there!
Note, all this information I shamelessly stole from
http://isotropic.org/uw/slithy/docs/py2exe.html


So here's the modified import section for your program:

import Image ## Python Image Library, For PNG support
import PngImagePlugin ## Explicitly import so it's included in EXE
import BmpImagePlugin ##read above
Image._initialized = 1## no frikin idea what this is for, doesn't seem to hurt.
import string


Well, there you go.
I py2exed it, and successfully read the Bill of Rights.
Another sample image is being used as one of my LJ pictures! It was swiped from nsa.gov and encoded with... a secret!
http://www.livejournal.com/allpics.bml?user=kris_schnee -- see "Digital" pic
Ah, we all need to watch those tricky rabbits more closely ;)
Hope that helps,
and go to sleep already :)
-Luke