losing handles of open files

Anthra Norell anthra.norell at tiscalinet.ch
Fri Jun 2 10:14:36 EDT 2006


----- Original Message -----
From: "Ben Finney" <bignose+hates-spam at benfinney.id.au>
To: <python-list at python.org>
Sent: Friday, June 02, 2006 12:30 AM
Subject: Re: losing handles of open files


> Please don't post non-text message bodies to discussion
> forums. Message bodies should be plain text.
>
> "Anthra Norell" <anthra.norell at tiscalinet.ch> writes:
>
> > If a piece of code exits with an exception before it closes an open
> > file, that file seems to remain locked, which is real pain in the
> > butt
>
> You will want to examine the 'finally' clause, which is executed after
> the 'try' suite regardless of exceptions.
>
>     <URL:http://docs.python.org/ref/exceptions.html>
>     <URL:http://docs.python.org/ref/try.html#try>
>
> You may also be interested in the 'with' statement, coming in Python
> 2.5, which will be a more natural way of expressing this idiom.
>
>     <URL:http://docs.python.org/dev/whatsnew/section-generators.html>
>
> --
>  \         "If nature has made any one thing less susceptible than all |
>   `\    others of exclusive property, it is the action of the thinking |
> _o__)                       power called an idea"  -- Thomas Jefferson |
> Ben Finney
>
> --
> http://mail.python.org/mailman/listinfo/python-list


Ben,
   Thank you very much for your input. I'm sorry about the text. I thought
it was text. Could it have to do with the font?
I am aware of the finally clause, though I just haven't met it face to face
yet on the learning curve yet. Guess the time has come. I shall study your
references.
   Frederic







More information about the Python-list mailing list