[BangPypers] Hi.......
steve
steve at lonetwin.net
Wed Jan 13 10:15:45 CET 2010
Hi,
On 01/13/2010 02:15 PM, Smrutilekha Swain wrote:
> i am doing a programme in which i have to copy a file from one directory to
> another....i have used "shutil.copy(src,dest)"...but it is showing error
> i.e., permission denied...as file is in 'w' mode...so plzzzzzz tell me what
> to do.........
Are you sure the permission denied is because the file is opened in 'w' mode ?
>>> l = open('foo', 'w')
>>> shutil.copy('bar', 'foo')
>>>
It is quite likely that you do not have sufficient privileges to write to the
target directory. For instance ...
>>> shutil.copy('foo', '/')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib64/python2.6/shutil.py", line 88, in copy
copyfile(src, dst)
File "/usr/lib64/python2.6/shutil.py", line 53, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 13] Permission denied: '/foo'
>>>
Make sure that normal copy (using the cp command on the shell/command prompt)
works before trying out shutil.copy. If that works but shutil.copy() doesn't,
could you place the entire traceback here ?
cheers,
- steve
--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
More information about the BangPypers
mailing list