(src, dst)
Copy data from src to dst
Copy data from src to dst
Copy data from src to dst
def copyfile(src, dst):
    """Copy data from src to dst"""
    if _samefile(src, dst):
        raise Error("`%s` and `%s` are the same file" % (src, dst))

    for fn in [src, dst]:
        try:
            st = os.stat(fn)
        except OSError:
            # File most likely does not exist
            pass
        else:
            # XXX What about other special files? (sockets, devices...)
            if stat.S_ISFIFO(st.st_mode):
                raise SpecialFileError("`%s` is a named pipe" % fn)

    with open(src, 'rb') as fsrc:
        with open(dst, 'wb') as fdst:
            copyfileobj(fsrc, fdst)
def copyfile ( src , dst ) : if _samefile ( src , dst ) : raise Error ( "`%s` and `%s` are the same file" % ( src , dst ) ) for fn in [ src , dst ] : try : st = os . stat ( fn ) except OSError : # File most likely does not exist pass else : # XXX What about other special files? (sockets, devices...) if stat . S_ISFIFO ( st . st_mode ) : raise SpecialFileError ( "`%s` is a named pipe" % fn ) with open ( src , 'rb' ) as fsrc : with open ( dst , 'wb' ) as fdst : copyfileobj ( fsrc , fdst )