[Zope] Copy file in filesystem
Paula Mangas
pamm@students.si.fct.unl.pt
Thu, 26 Jul 2001 15:42:45 +0100 (WEST)
Hi!
Try this:
import shutil
shutil.copyfile("file_to_copy_path", "destination_path")
I think, this works to.
Paula Mangas
On Thu, 26 Jul 2001, Gitte Wange wrote:
> On Thursday 26 July 2001 16:32, you wrote:
> > Hi!
> >
> > You can do something like this:
> >
> > f = open("file_to_copy")
> > text = f.read()
> > f.close()
> > f = open("new_file_name", "w")
> > f.write(text)
> > f.close()
> >
> >
> > I hope this helps,
> > Paula Mangas
>
> Thank you.
> This could be a solution .. but python has a "built-in" function called copy.
> Thought I could use that ..
>
> Gitte
>
> >
> > On Thu, 26 Jul 2001, Gitte Wange wrote:
> > > 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,
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
--
============================================================
Quando tiver duvidas, nao questione aqueles que so' tem
certezas, pois corre o risco de ficar com mais duvidas!...
------------------------------------------------------------
Paula Monteiro Mangas
e-mail: Paula.Mangas@mail.com
URL: http://students.fct.unl.pt/~pamm/
TMV: (+351) 96 2559034
============================================================