Py2exe executable not loading images

Anand anandpillai6 at yahoo.com
Fri Oct 11 08:59:51 EDT 2002


Hi Pythons

      I have a simple viewer class in python using wxPython and PIL.
The code uses PIL Image class to open an image and wxPython classes
namely
wxFrame, wxBitmap, wxImage to paint it on to a wxPanel. 

 The open function looks something like this:

   def OpenImage(self, fileName):
   file2 = fileName.encode('latin-1')
          #str = StringIO.StringIO(file2)
          self.imgsrc = Image.open(str(file2))
          self.img = apply( wxEmptyImage, self.imgsrc.size ) 
          self.img.SetData( self.imgsrc.convert( "RGB").tostring() ) 

           # Rest of code...

 
     The code works fine for all images when run as a python script.
When
I create a win32 executable using py2exe and setup.py, the Image class
fails with a  message <reproduced here>

<Quote>
File "<string>", line 453, in OpenImage
File "PIL\Image.pyc", line 960, in open
IOError: cannot identify image file
</Quote>

 Any ideas friends ?

 Thanks for help.

Anand Pillai



More information about the Python-list mailing list