[reportlab-users] IOError: Too many open files

Mike Driscoll mike at pythonlibrary.org
Thu Nov 21 10:36:41 EST 2013

Hi Marius,

On Thu, Nov 21, 2013 at 1:27 AM, Marius Gedminas <marius at gedmin.as> wrote:


> >

> > I tried changing tactics by reading the file into StringIO and passing

> > Image that, but that just moves the issue to where I read the file. For

> > those curious, I do this:

> >

> > with open(self.logo_path, "rb") as logo_fh:

> > self.logo_path = StringIO( logo_fh.read() )

> >

> > Anyway, now I get the same basic error, but at this line instead.


> This is the line that hits the limit, but not necessarily the line that

> leaks open file descriptors.


> Can you wrap the code in a try/except: import pdb; pdb.post_mortem() and

> then check what files are open by running 'lsof -p $pid' or

> 'ls -l /proc/$pid/fd' in a shell?


> > I am running on CentOS with Python 2.6. Thanks!


> Marius Gedminas

> --

> #define QUESTION ((bb) || !(bb)) /* Shakespeare */



You were right. Doing as you suggested showed that the issue was a logger
object creating lots and lots of handles to the same log file. I'm not sure
why it's doing that, but that definitely takes the issue outside of
Reportlab. Removing the logging call fixes the issue, so now I have to
decide if the outside process's log is "good enough" or if I want to try to
find a way to re-add it.

Thanks again!

Mike Driscoll

Blog: http://blog.pythonlibrary.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20131121/d7abba14/attachment.htm>

More information about the reportlab-users mailing list