BOMBOLOM.COM

(python) PY2EXE and the PIL library error

Posted by de José Lopes

When you get the following message its due to a compatibility problem between py2exe and PIL library.

File "Image.pyc", line 1571, in open
IOError: cannot identify image file

To solve this problem one must declare explicitly the PIL libraries that must be imported.
So, on the python file that we want ot generate the exe, they must ne declared like for example:

import Image
import BmpImagePlugin # if you are using bitmaps
import JpgImagePlugin # if you are using jpg
import PngImagePlugin # if you are using png

The explicit declaring of these imports may not be necessary if you are running puthon from a shell, but they will be necessary to run the exe file generated by py2exe.

2007.05.31 | There's more... | Comments 0 | Tags , ,

Deixe a sua mensagem:

Nome:


E-mail:


URL:


Comment:

Secret number

To send you comment you must insert the "secret number" on the box


Made with PyBlosxom | Add to Google