def move(src, dst):
 real_dst = dst
 if os.path.isdir(dst):
  if _samefile(src, dst):
   os.rename(src, dst)
   return
  real_dst = os.path.join(dst, _basename(src))
  if os.path.exists(real_dst):
   raise Error, ("Destination path '%s' already exists" % real_dst)
 try:
  os.rename(src, real_dst)
 except OSError:
  if os.path.isdir(src):
   if _destinsrc(src, dst):
    raise Error, ("Cannot move a directory '%s' into itself '%s'." % (src, dst))
   copytree(src, real_dst, symlinks=True)
   rmtree(src)
  else:
   copy2(src, real_dst)
   os.unlink(src)

def move ( src , dst ) : real_dst = dst if os . path . isdir ( dst ) : if _samefile ( src , dst ) : os . rename ( src , dst ) return real_dst = os . path . join ( dst , _basename ( src ) ) if os . path . exists ( real_dst ) : raise Error , ( "Destination path '%s' already exists" % real_dst ) try : os . rename ( src , real_dst ) except OSError : if os . path . isdir ( src ) : if _destinsrc ( src , dst ) : raise Error , ( "Cannot move a directory '%s' into itself '%s'." % ( src , dst ) ) copytree ( src , real_dst , symlinks = True ) rmtree ( src ) else : copy2 ( src , real_dst ) os . unlink ( src )
move that ensures filesystem encoding of paths .