[ python-Bugs-1739115 ] shutil.rmtree's error message is confusing

SourceForge.net noreply at sourceforge.net
Mon Jun 18 16:41:58 CEST 2007


Bugs item #1739115, was opened at 2007-06-18 16:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1739115&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Björn Lindqvist (sonderblade)
Assigned to: Nobody/Anonymous (nobody)
Summary: shutil.rmtree's error message is confusing

Initial Comment:
If you run shutil.rmtree(something) on Windows where something is file and not a directory, you get the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\Lib\shutil.py", line 161, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "C:\Python25\Lib\shutil.py", line 159, in rmtree
    names = os.listdir(path)
WindowsError: [Error 22] The directory name is invalid: 'foobar/*.*'

The error message is pretty confusing and it shouldn't be to hard to fix it. Plus, if it shouldn't be possible to remove files with shutil.rmtree(), then the docs should say so.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1739115&group_id=5470


More information about the Python-bugs-list mailing list