[issue8705] shutil.rmtree with empty filepath

Dan Koch report at bugs.python.org
Fri May 14 16:58:47 CEST 2010


Dan Koch <kochdb at ornl.gov> added the comment:

Here's the session printout. Desktop files under Vista still get deleted despite the exception. Does not occur on Fedora 12 or Mac OS X. I can code around it by testing for a blank filepath, but it was a surprise.

C:\Users\ko5>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, shutil, user
>>> desktop_dir = os.path.join(user.home, 'Desktop')
>>> os.chdir(desktop_dir)
>>> os.getcwd()
'C:\\Users\\ko5\\Desktop'
>>> shutil.rmtree('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\shutil.py", line 225, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\Python26\lib\shutil.py", line 223, in rmtree
    os.rmdir(path)
WindowsError: [Error 3] The system cannot find the path specified: ''
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8705>
_______________________________________


More information about the Python-bugs-list mailing list