Commit c0cc55c5 by rfkelly0

better error reporting from base._shutil_copyfile

parent 9bd05e3b
......@@ -517,7 +517,14 @@ class FS(object):
@convert_os_errors
def _shutil_copyfile(self,src_syspath,dst_syspath):
try:
shutil.copyfile(src_syspath,dst_syspath)
except IOError, e:
# shutil reports ENOENT when a parent directory is missing
if getattr(e,"errno",None) == 2:
if not os.path.exists(dirname(dst_syspath)):
raise ParentDirectoryMissingError(dst_syspath)
raise
def move(self, src, dst, overwrite=False, chunk_size=16384):
"""Moves a file from one location to another.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment