[Tutor] shutils.copytree

Tony Cappellini cappy2112 at gmail.com
Fri Jan 11 14:44:29 CET 2008


> The source for copytree says, "The destination directory must not
> already exist." I suppose that is why you have a problem but I don't
> know the specific cause. Did you get a traceback?
>
> The source also says, "Consider this example code rather than the
> ultimate tool" so maybe you should just copy it and make a version that
> does what you want. See shutil.py in your Python lib directory.

Yes, I did read that and was shocked. Is everything in python that
iffy? I believe there was a traceback, I'll have to look again when I
am back at work tomorrow.
The problem with that concept of "modifying the distribution as you
go" is that those changes must be moved to every system where your
program will run, and whenever python is updated, you have to remember
to save the changes before uninstalling the current version. The
shutils in the new python dist may not be compatible with your old
changes and may require more work. Bad idea. How did that ever get
approved to be in the standard distribution?

>>Also -- vaguely -- have a look at my notes on file copying
>>under windows to consider alternatives:
>>http://timgolden.me.uk/python/win32_how_do_i/copy-a-file.html

I had started doing xcopy, but it became unreliable but I don't know
why yet, so I decided to try shutil.
I am doing the file copies in a thread, but that shouldn't matter.
I will look at your other file copy suggestions.

Thansk for both replies


Message: 1
Date: Fri, 11 Jan 2008 09:02:49 +0000
From: Tim Golden <mail at timgolden.me.uk>
Subject: Re: [Tutor] shutils.copytree
Cc: Tutor Python <tutor at python.org>
Message-ID: <478730B9.9000904 at timgolden.me.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


More information about the Tutor mailing list