delete will assure file is deleted?

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Thu Apr 28 07:16:09 EDT 2005


On Wed, 27 Apr 2005 17:28:04 +0200, rumours say that "Fredrik Lundh"
<fredrik at pythonware.com> might have written:

>> import errno
>> 
>> try:
>>   ...
>> except OSError, exc:
>> if exc.errno == errno.ENOENT: # file inexistant
>>      ...
>> elif exc.errno == errno.EPERM: # no permissions
>>      ...

>make that
>
>    elif exc.errno in (errno.EACCES, errno.EPERM): # no permissions

Yep, you're right (you wouldn't be a bot otherwise, right?-)

BTW I remember a post last summer about subclassing OSError (found it:
http://groups.google.com.gr/groups?selm=87llgxuyf5.fsf%40pobox.com --not
exactly what I remembered, but close.)

I think throwing subclasses of OSError based on errno would make life
easier --always assuming that Python requires POSIX conformance on all
platforms.  I will give it a try RSN...
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...



More information about the Python-list mailing list