def copy_exists(srcname, dstname, symlinks=False):
    if not os.path.exists(srcname):
        return
    errors = []
    try:
        if symlinks and os.path.islink(srcname):
            linkto = os.readlink(srcname)
            os.symlink(linkto, dstname)
        else:
            shutil.copyfile(srcname, dstname)
            shutil.copystat(srcname, dstname)
    except (__HOLE__, os.error), why:
        errors.append((srcname, dstname, why))
    if errors:
        print errors
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/util.py/copy_exists