[Python-bugs-list] [ python-Bugs-574773 ] removedirs() is not a recursive function
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 02 Jul 2002 14:06:31 -0700
Bugs item #574773, was opened at 2002-06-27 16:37
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=574773&group_id=5470
Category: Documentation
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Dani (asqui)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: removedirs() is not a recursive function
Initial Comment:
The _Python Library Reference_, section 6.1.4: os: Files
and Directories_ lists the following definition of
os.removedirs():
removedirs(path)
Recursive directory removal function. Works like rmdir()
except that, if the leaf directory is successfully removed,
directories corresponding to rightmost path segments
will be pruned way until either the whole path is
consumed or an error is raised (which is ignored,
because it generally means that a parent directory is not
empty). Throws an error exception if the leaf directory
could not be successfully removed. New in version
1.5.2.
>From what I can see there is nothing recursive about
os.removedirs(), just simple iteration.
This is misleading because it suggests something like
removedirs('foo/bar/') will remove 'foo/bar/' and all its
subdirectories, providing they are empty. When in fact
what it does is remove directory foo/bar/ if it is empty,
then remove foo/ if it is empty.
(I'm fairly new to python so I could be mistaken, but I
checked with peers on IRC who instructed me to submit
a bug report.)
----------------------------------------------------------------------
>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-07-02 17:06
Message:
Logged In: YES
user_id=3066
The documentation is trying to state that removedirs() is
removing directories in a recursive manner, not that the
implementation is recursive (which is completely irrelevant
to the documentation).
I've attempted to clarify the docs (Doc/lib/libos.tex 1.91),
but removedirs() is just a really weird function.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=574773&group_id=5470