def copyfile(src, dst):
 if _samefile(src, dst):
  raise Error, ('`%s` and `%s` are the same file' % (src, dst))
 fsrc = None
 fdst = None
 try:
  fsrc = open(src, 'rb')
  fdst = open(dst, 'wb')
  copyfileobj(fsrc, fdst)
 finally:
  if fdst:
   fdst.close()
  if fsrc:
   fsrc.close()

def copyfile ( src , dst ) : if _samefile ( src , dst ) : raise Error , ( '`%s` and `%s` are the same file' % ( src , dst ) ) fsrc = None fdst = None try : fsrc = open ( src , 'rb' ) fdst = open ( dst , 'wb' ) copyfileobj ( fsrc , fdst ) finally : if fdst : fdst . close ( ) if fsrc : fsrc . close ( )
copy a file and its modification times .