why doesn't is work?a script to backup a directory

Fredrik Lundh fredrik at pythonware.com
Sat Apr 1 08:06:07 EST 2006


obeeker at gmail.com wrote:

> please don't read the prevous post ,please read this one:
>
> thank you for your suggestion and apologize for my mistake.
> if i run it and answer the raw_input with "Enter" i get
>
> sth is wrong
> press Return>
>
> i comment the try-except and run it and answer the raw_input with
> "Enter"
> and get message  following:
>
>
> Traceback (most recent call last):
>   File "G:\9\Eb\updateEbBb.py", line 41, in -toplevel-
>     updateNow(base)
>   File "G:\9\Eb\updateEbBb.py", line 28, in updateNow
>     update(d0)
>   File "G:\9\Eb\updateEbBb.py", line 16, in update
>     shutil.rmtree(i)
>   File "D:\Program Files\Python24\lib\shutil.py", line 155, in rmtree
>     onerror(os.listdir, path, sys.exc_info())
>   File "D:\Program Files\Python24\lib\shutil.py", line 153, in rmtree
>     names = os.listdir(path)
> WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*'

shutil.rmtree() expects a directory name, not a file pattern.  if you leave
out the "*.*" part at the end, it should do what you want.

(assuming you want to remove the eb/mb/S directory, that is)

</F>






More information about the Python-list mailing list