File IO errors with PyPDF

John Henry john106henry at
Sat Mar 10 00:59:13 CET 2007

Hi list,

I am having trouble with PyPDF (tried earlier as well as latest
version 1.9).   I am using it to combine a number of single page PDF
files into one.  It works perfectly for up to 8 files but after that,
I get a "too many files opened" message.  My code goes somewhat like:

PdfOutput = PdfFileWriter()
ofile = of the combined pdf...

for doc_file in (....a bunch of single page pdf files...)
	inp=file(doc_file, "rb")

outputStream = file(ofile, "wb")

As you can see, I closed each one of the files before proceeding and
yet I get the "too many files opened" exception.

In addition, sometimes I get a "file already closed" message from
the .write function even when the number of files are small (like 5).

Anybody has any suggestions?

If not, do you have recommendations for alternative package?  My needs
are very simple - I just need to combine the single page pdfs into


More information about the Python-list mailing list