permission denied in shutil.copyfile

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Jul 14 03:51:55 CEST 2007


En Fri, 13 Jul 2007 12:10:20 -0300, Ahmed, Shakir <shahmed at sfwmd.gov>  
escribió:

> Is there any way to copy a file from src to dst if the dst is
> exclusively open by other users.
>
> I am using
>
> src  = 'c:\mydata\data\*.mdb'
> dst = 'v:\data\all\*.mdb'
>
> shutil.copyfile(src,dst)
>
> but getting error message permission denied.

1) try with a local copy too, and you'll notice an error too - it's  
unrelated to other users holding the file open.
2) use either r'c:\mydata\data' or 'c:\\mydata\\data\'
3) shutil.copyfile copies ONE FILE at a time.
4) use glob.glob to find the desired set of files to be copied; and  
perhaps you'll find copy2 more convenient.


-- 
Gabriel Genellina




More information about the Python-list mailing list