views:

282

answers:

1

I'm trying to build PIL 1.1.6 against cygwin or mingw whilst running against a windows install of python. When I do either the build works but I get the following failure when trying to save files.

$ python25
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL.Image import open
>>> im = open('test.gif')
>>> im.save('output1.gif')
Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python25\Lib\site-packages\PIL\Image.py", line 1405, in save
    save_handler(self, fp, filename)
  File "c:\Python25\Lib\site-packages\PIL\GifImagePlugin.py", line 291, in _save

    ImageFile._save(imOut, fp, [("gif", (0,0)+im.size, 0, rawmode)])
  File "c:\Python25\Lib\site-packages\PIL\ImageFile.py", line 491, in _save
    s = e.encode_to_file(fh, bufsize)
IOError: [Errno 0] Error
>>>

I'm not compiling with the libraries for jpeg or zip support but I don't think this should be relevant here.

The failing line seems to be a write in encode_to_file in encode.c.

I'm suspiscious that this occurs because a file descriptor is being passed from Python (which was build under visual studio 2003) to _imaging.pyd but that the file descriptors don't match because on windows file descriptors are and abstraction on top of the operating system. Does anyone know anything about this?

+1  A: 

As far as I can tell from some cursory Google searching, you need to rebase the DLLs after building PIL in order for it to work properly on Cygwin.

References:

Jay