Copy file in filesystem
Hello out there .. I know this is a python question (please forgive me) but I couldn't find an answer in the python docs. 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> I get this error: Zope Error Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: call of non-function (type module) If I don't use the import copy Zope just returns an error saying that copy isn't defined. How do I then make a copy of a file ??? Regards, -- Gitte Wange Jensen Sys Admin, Developer and a lot more MMmanager.org Aps, Denmark Phone: +45 29 72 79 72 Email: gitte@mmmanager.org Web: www.mmmanager.org Quote of the day: In the beginning, there was Fortran. - James Gray
--- Gitte Wange <gitte@mmmanager.org> wrote: ...
I have tried with this: import copy
<a lot of code> copy(file_reposit, new_fnreposit) </a lot of code>
I get this error:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: TypeError Error Value: call of non-function (type module)
If I don't use the import copy Zope just returns an error saying that copy isn't defined.
How do I then make a copy of a file ???
is this an external method? wonder if copy is allowed in Python Script! hmm... __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
On Thursday 26 July 2001 16:29, you wrote:
--- Gitte Wange <gitte@mmmanager.org> wrote: ...
I have tried with this: import copy
<a lot of code> copy(file_reposit, new_fnreposit) </a lot of code>
I get this error:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: TypeError Error Value: call of non-function (type module)
If I don't use the import copy Zope just returns an error saying that copy isn't defined.
How do I then make a copy of a file ???
is this an external method? wonder if copy is allowed in Python Script! hmm...
no no no :-)) This script is placed in the filesystem and no - it isn't an external method. It's a module in a Zope Product. Gitte
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>
participants (3)
-
Amr Malik -
Gitte Wange -
Thomas B. Passin