Problem compiling Tkinter program with bmp images using py2
fredrik at pythonware.com
Thu Jan 26 03:16:58 EST 2006
erkidevries at pandora.be wrote:
> and put them on the widgets like this:
> Label(win, text=message, background=rgb(150,150,120), image=photo2).pack()
> Now, I want the same program to run as exe file on another computer,
> so I compiled it with py2exe. I copied the bmp's to the same folder as
> my executable. When I try to run the compiled exe i get:
> Traceback (most recent call last):
> File "make_ma2.py", line 461, in ?
> File "PIL\Image.pyo", line 1745, in open
> IOError: cannot identify image file
(did you try googling for the error message?)
> Are there specific things to take care of when compiling a tkinter program
> with bitmap backgrounds?
it's PIL that's complaining, not Tkinter. PIL uses dynamic loading of format
drivers, which means that py2exe won't find them. the easiest way to fix
this is to import the drivers you need in your main program; see e.g.
More information about the Python-list