shutil.rmtree raises "OSError: [Errno 39] Directory not empty" exception

Maria Liukis liukis at usc.edu
Sat Jul 11 01:28:06 CEST 2009


Hello,

Has anybody seen an exception "OSError: [Errno 39] Directory not  
empty" raised by shutil.rmtree? The code that raised an exception  
creates a lot of directories with files, and then removes them. I got  
an exception when one of such directories was removed. Here is the  
backtrace:

     shutil.rmtree(filename)
   File "/usr/lib64/python2.5/shutil.py", line 178, in rmtree
     onerror(os.rmdir, path, sys.exc_info())
   File "/usr/lib64/python2.5/shutil.py", line 176, in rmtree
     os.rmdir(path)
OSError: [Errno 39] Directory not empty: /path/to/my/dir

According to the documentation, shutil.rmtree should not care about  
directory being not empty.

Thanks for the help,
Masha
--------------------
liukis at usc.edu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090710/557f5e85/attachment.html>


More information about the Python-list mailing list