Bug in shutil.rmtree?

Tim Roberts timr at probo.com
Sun Aug 12 21:23:39 EDT 2001


foobarickknob at yahoo.com (Scott Taylor) wrote:

>I'm using shutil.rmtree on W2K, and the way it's acting doesn't seem
>to jive w/ the docs.  Isn't the second param to rmtree supposed to
>ignore any errors if it runs across any?
>
>shutil.rmtree( 'c:\\foobartest', 1 ) gives me this exception...
>
>WindowsError: [Errno 3] The system cannot find the path specified:
>'foobartest'
>
>... if c:\\foobartest doesn't exist.  Shouldn't I not get an exception
>if the second param is true?

Interesting.  The "ignore_errors" parameter ignores any errors that occur
once removing begins.  It doesn't ignore errors while it is building the
list of removal commands, and that's where this error occurs.

Tough call.  I would have to agree that the behavior doesn't match the doc.
It'd be easy to add protection for this.  I'll have to let others wiser
than me decide whether it makes sense to add it.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list