I am trying to copy fgdb from one path to another using Python.
copy(base.gdb,dest)
And got the message:
Error Info:
[Errno 13] Permission denied:
How to fix it?
Answer
As far as a file system is concerned, a file gdb is a directory - trying to copy one as a single file will not work. Try this out:
import shutil, errno
def copyanything(src, dst):
try:
shutil.copytree(src, dst)
except OSError as exc: # python >2.5
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else: raise
No comments:
Post a Comment