Good ideas, but I've tried them already: -No del command, or replacing it with a set-to-null, neither solve my file access problem. -PdfFileReader has no close() function, and causes an error. Weird, but true. -pdf_handle.close() on the other hand, fails to solve the problem.
On Tue, Nov 16, 2010 at 11:25 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com>wrote: > On Tue, 16 Nov 2010 17:37:10 -0800, Brett Bowman <bnbow...@gmail.com> > declaimed the following in gmane.comp.python.general: > > > > > And then I test the result: > > try: > > pdf_handle = open(outputFile, "rb") > > pdf_pypdf = PdfFileReader(pdf_handle) > > del pdf_pypdf > > del pdf_handle > > except Exception, e: > > return "Unable to open file: %s with error: %s" % (outputFile, > > str(e)) > > > You seem enamored of "del", which is something I've only used for > special purposes, and even then rarely -- binding a null object to the > name is just as effective for most uses. > > While the common Python does garbage collect objects when the > reference count goes to zero, there is no real guarantee of this. > > I'd replace that > del pdf_handle > whit > pdf_handle.close() > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list