delete will assure file is deleted?

Fredrik Lundh fredrik at pythonware.com
Wed Apr 27 11:28:04 EDT 2005


Christos TZOTZIOY Georgiou wrote:

> Although I don't have experience with FreeBSD, so far checking the
> exception's errno args does the job.

if that doesn't work on FreeBSD, FreeBSD is not a proper Unix.

> 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

</F>




More information about the Python-list mailing list