[Zope] Copy file in filesystem

Thomas B. Passin tpassin@mitretek.org
Thu, 26 Jul 2001 11:03:25 -0400


First of all, "copy" copies objects, not files.  But even if it did what you
want, you have to call copy(), the function, within copy, the module:

import copy

copy.copy(...)

or,

from copy import copy
copy(...)

In other words, the function name "copy" is independent of the module name
"copy" - they don;t have to be the same but here by coincidence they are.

However, the "shutil" library module does have a file copy function,

copyfile (src, dst)

If you want to copy unix permissions, etc,. you can then do

copymode (src, dst)

I don't know if the Zope python scriping environment allows this to execute;
you may need to call it from an external method.

Cheers,

Tom P

[Gitte Wange]


The problem is very simple - I need to make a copy of a file in the
filesystem in a pythhon module.

I have tried with this:
import copy

<a lot of code>
copy(file_reposit, new_fnreposit)
</a lot of code>