On Feb 19, 1:38 am, Steven D'Aprano <steve
+comp.lang.pyt...@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))
> ...
> 3
> 3
> 3
>
> --
> Steven
so i changed it to
shutil.copy2(files, os.path.join(destpath,os.path.basename(files)))
seems to be working.
in the mornig when im not bleary eyed. ill check again but this look
like the fix. thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to