PIL 1.1.1 Problem with Windows NT, Python 1.5.2
Roger Burnham
rburnham at cri-inc.com
Wed Nov 8 16:50:37 EST 2000
Using VC++ 6.0 (no service packs) and Python 1.5.2.
Got it to build (after undef'ing INT32 and UINT32 before including windows.h).
Now,
>>> import Image
>>> img = Image.open(r'C:\TMP\160x160.jpg')
>>> img.size
(160, 120)
>>> img.getpixel((10,10))
(64, 74, 73)
>>> img.save('c:/tmp/fred.jpg')
Traceback (innermost last):
File "<interactive input>", line 0, in ?
File "C:\Python\Imaging\Image.py", line 674, in save
SAVE[string.upper(format)](self, fp, filename)
File "C:\Python\Imaging\JpegImagePlugin.py", line 307, in _save
ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
File "C:\Python\Imaging\ImageFile.py", line 368, in _save
s = e.encode_to_file(fh, bufsize): (0, 'Error')
Running under the debugger, tracing into _encode_to_file (encode.c), at the line
if (write(fh, buf, status) < 0) {
I step into _write and trip over
if ( ((unsigned)fh >= (unsigned)_nhandle) ||
!(_osfile(fh) & FOPEN) )
{
/* out of range -- return error */
errno = EBADF;
_doserrno = 0; /* not o.s. error */
return -1;
}
here, fh = 4, _nhandle = 32.
MSDN says:
EBADF
Bad file number. There are two possible causes:
1) The specified file handle is not a valid file-handle value
or does not refer to an open file.
2) An attempt was made to write to a file or device opened for
read-only access.
Anyone offer any clues???
Thanks,
Roger Burnham
rburnham at cri-inc.com
More information about the Python-list
mailing list