[Image-SIG] Python-PIL bug report

Fredrik Lundh fredrik at pythonware.com
Fri May 28 10:35:10 CEST 2010


Your operating system has a limit to the amount of files that you can
have open in a single program, and the error message simply tells you
that you've exceeded this limit.  To work around this, you can:

-- avoid holding on to the objects returned by Image.open(); either
process the data as you go, or make explicit copies of the images
(im.copy()).

-- have Image.open() read from an opened file object instead of a
filename, and explicitly close the file when you've read the data you
need:

    fp = open(filename, "rb")
    im = PIL.Image.open(fp)
    im.load() # force loading of the first frame
    fp.close() # force-close the file

</F>

On Thu, May 27, 2010 at 7:25 AM, Diego Trujillo <trujillo.dp at gmail.com> wrote:
> Hello,
>
> I am using PIL to render a view in pyGame and I need to rewrite a buffer
> image that is loaded to the pygame window after it is rewritten. It works
> fine but after a while I get this error:
>
> Traceback (most recent call last):
>   File "./environmentPYG.py", line 42, in <module>
>   File "ouroborus/birdcageLibrary/pyGameVisual.py", line 40, in generate
>   File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1400, in save
> IOError: [Errno 24] Too many open files: 'buffer.tiff'
>
> I am running python 2.6 under Ubuntu 9.10 (Karmic) GNU/Linux.
>
> I've checked the reference on line 1400 in save but it does not make any
> sense to me. I hope this bug report is somewhat useful to you.
>
> Thanks.
>
> --
> Diego Trujillo Pisanty
>
>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>


More information about the Image-SIG mailing list