[Image-SIG] PIL 1.1.7, windows compilation: problem to save image file

Erwan Loaëc erwan.loaec at cgin.fr
Thu Mar 17 11:49:35 CET 2011


Hello,

I've successfully compiled PIL under windows XP 32 bits.

When I try to save a JPEG or TIFF file, I obtain the following trace:

Traceback (most recent call last):
   File "D:\testpy\testPIL.py", line 9, in <module>
     im.save(r"D:\testpy\mytest.jpg")
   File "C:\Python25\lib\site-packages\PIL\Image.py", line 1439, in save
     save_handler(self, fp, filename)
   File "C:\Python25\lib\site-packages\PIL\JpegImagePlugin.py", line 
471, in _s
ave
     ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
   File "C:\Python25\lib\site-packages\PIL\ImageFile.py", line 499, in 
_save
     s = e.encode_to_file(fh, bufsize)
IOError: [Errno 0] Error


The problem is the "write(fh, buf, status)" in encode.c which always 
return "-1". When I create a new handle directly in encode.c

example:
fh = open( "mytest.jpg", _O_WRONLY | _O_CREAT | _O_BINARY );

The write() works perfectly. So I think the problem should be related to 
the file descriptor...

So, is anyone know the solution for windows ?


Note: under linux, everything works perfectly. It really seems to be a 
"windows" issue.


Thanks,

-- 
Erwan


More information about the Image-SIG mailing list