Size: 2148
Comment: converted to 1.6 markup
|
Size: 449
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= The Problem = I use [[http://www.pythonware.com/products/pil/|PIL]] from pythonware. It has some very dynamic initialising routines. excerpt out of Image.py {{{ #!python def init(): "Load all file format drivers." global _initialized if _initialized >= 2: return visited = {} directories = sys.path try: directories = directories + [os.path.dirname(__file__)] except NameError: pass # only check directories (including current, if present in the path) for directory in filter(isDirectory, directories): fullpath = os.path.abspath(directory) if visited.has_key(fullpath): continue for file in os.listdir(directory): if file[-14:] == "ImagePlugin.py": f, e = os.path.splitext(file) try: sys.path.insert(0, directory) try: __import__(f, globals(), locals(), []) finally: del sys.path[0] except ImportError: if DEBUG: print "Image: failed to import", print f, ":", sys.exc_value visited[fullpath] = None if OPEN or SAVE: _initialized = 2 }}} main problem with all this stuff: all this directory-voodoo is out of access when using py2exe. Maybe it is fixable by doing very strange things I do not know about. = Explanation = PIL tries to automagically learn which Image-Plugins are available. "available" is well defined as long it is a Python standard installation. "available" gets very vague when using py2exe. = Solution = Make it dumb. {{{ #!python # PIL schafft das nicht alleine, wenn gepy2exed import Image import PngImagePlugin [...] Image._initialized=2 }}} before using PIL, I manually import Image and also the needed *ImagePlugins {{{ #!python [...] could be JpegImagePlugin, BmpImagePlugin etc. }}} Finally I force Image to believe it is fully initialized, so nobody tries directory scanning. |
Hello! My name is Leandro. <<BR>> It is a little about myself: I live in Switzerland, my city of Hagenbuch. <<BR>> It's called often Northern or cultural capital of . I've married 2 years ago.<<BR>> I have two children - a son (Jacques) and the daughter (Irvin). We all like Amateur geology.<<BR>> <<BR>> Feel free to visit my blog post [[http://www.amazon.com/Awareness-Classic-Silver-Crystal-Bracelet/dp/B00J4RSPOI/|silver autism bracelet]] |
Hello! My name is Leandro.
It is a little about myself: I live in Switzerland, my city of Hagenbuch.
It's called often Northern or cultural capital of . I've married 2 years ago.
I have two children - a son (Jacques) and the daughter (Irvin). We all like Amateur geology.
Feel free to visit my blog post silver autism bracelet