[pygtk] File doesn't get closed: how to make sure that the object is 'freed'?

Arjen Nienhuis arjen at bleenterprises.nl
Mon Mar 16 07:38:01 WST 2009


Hi,

I'm using the glib bindings of poppler through python. Everything works fine:

- I can open a pdf file
- I can render it through pycairo

but after that the file stays open. For each use of
'document_new_from_file' one extra file descriptor is used (according
to lsof). If I leave the program running for a while, I get 'too many
open files'.

This is a simple test case that fails after a while:

=======================================

import os
import poppler

for i in range(1000000):
    uri = "file://" + os.path.abspath("test.pdf")
    doc = poppler.document_new_from_file(uri, None)

=======================================

Can I check if doc gets freed? Can I force it to free?

The source code for python-poppler can be found here:

http://bazaar.launchpad.net/~poppler-python/poppler-python/trunk/files

I didn't write the wrapper, but if someone can help me fixing it I
would be very happy!

Groeten, Arjen


More information about the pygtk mailing list