[Zope] Copy file in filesystem

Gitte Wange gitte@mmmanager.org
Thu, 26 Jul 2001 17:30:23 +0200


On Thursday 26 July 2001 16:42, you wrote:
> Hi!
>
> Try this:
>
>
> import shutil
>
> shutil.copyfile("file_to_copy_path", "destination_path")
>
>
> I think, this works to.
> Paula Mangas

Thank you :-))

This works just perfekt :-)

Greetings
Gitte


> 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 )