parameters: (from_path, to_path, retry_limit=20)
docstring: Rename a directory, with retry.
docstring_summary: Rename a directory, with retry.
docstring_tokens: Rename a directory with retry .
function: def rename_with_retry(from_path, to_path, retry_limit=20):
    """Rename a directory, with retry."""
    for retry in range(retry_limit):
      try:
        if retry > 0:
          retry_sleep_sec = 0.1
          time.sleep(retry_sleep_sec)
          warn('Retrying failed rename: "%s" --> "%s"' % (from_path, to_path))
        os.rename(from_path, to_path)
        return
      except IOError:
        continue
    error('\nRename failed after %s retries: "%s" --> "%s"' %
          (retry_limit, from_path, to_path))
function_tokens: def rename_with_retry ( from_path , to_path , retry_limit = 20 ) : for retry in range ( retry_limit ) : try : if retry > 0 : retry_sleep_sec = 0.1 time . sleep ( retry_sleep_sec ) warn ( 'Retrying failed rename: "%s" --> "%s"' % ( from_path , to_path ) ) os . rename ( from_path , to_path ) return except IOError : continue error ( '\nRename failed after %s retries: "%s" --> "%s"' % ( retry_limit , from_path , to_path ) )