Cannot Remove File: Device or resource busy

Brett Bowman bnbowman at gmail.com
Wed Nov 17 03:16:29 EST 2010


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
<wlfraed at ix.netcom.com>wrote:

> On Tue, 16 Nov 2010 17:37:10 -0800, Brett Bowman <bnbowman at 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
>        wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101117/2417a161/attachment.html>


More information about the Python-list mailing list