[reportlab-users] 2.4 too many open files in-line images

Robin Becker robin at reportlab.com
Tue Aug 31 05:06:03 EDT 2010

On 19/08/2010 21:50, Steve Romanow wrote:

> On 8/19/2010 4:48 PM, Mike van der Stoop wrote:

>> Using report lab 2.4, Python 2.6 and having issues attaching a

>> signature jpeg to a letter using inline technique, getting IOerror

>> which is really too many open files error. When the letter count is

>> small it works fine.



> I haven't seen the code, but can you close the file between letters, or

> cache it and don't reopen it for each letter?


This problem came up in the wikipedia pdf export work, I think the solution was
to add an extra control to the ImageReader class to make the file opening lazy
or caching/re-openable in some way. See the comment in reportlab/rl_config.py
for the variable imageReaderFlags. I think wikipedia uses Ralf Schmitt's method
(ie using the value -1). The other flag values relate to cases where the image
is transient and may not be a file.
Robin Becker

More information about the reportlab-users mailing list