hayesjdno3 at yahoo.com
Sat Feb 19 07:55:12 CET 2011
On Feb 19, 1:38 am, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Fri, 18 Feb 2011 22:13:42 -0800, ecu_jon wrote:
> > ok changed the try/except to just a file copy and got this:
> > sourcepath is :
> > [u'I:\\college\\spring11\\capstone-project\\facbac-009.py']
> Note that it's a list.
> > shutil.copy2(sourcepath,
> > os.path.join(destpath,os.path.basename(files)))
> Note that you are calling copy2 with the first argument as a list.
> > TypeError: coercing to Unicode: need string or buffer, list found
> Note that the error tells you exactly what is wrong.
> > yes i see the list.
> > but shouldnt this "for files in sourcepath:" parse thru the list ... ?
> Yes it does. So what? You don't use files, you use sourcepath each time.
> >>> source = ['a', 'bb', 'ccc']
> >>> for x in source:
> ... print(len(source))
so i changed it to
seems to be working.
in the mornig when im not bleary eyed. ill check again but this look
like the fix. thanks.
More information about the Python-list