def chown(path, user, group):
    path = os.path.expanduser(path)

    uid = user_to_uid(user)
    gid = group_to_gid(group)
    err = ''
    if uid == '':
        if user:
            err += 'User does not exist\n'
        else:
            uid = -1
    if gid == '':
        if group:
            err += 'Group does not exist\n'
        else:
            gid = -1
    if not os.path.exists(path):
        try:
            # Broken symlinks will return false, but still need to be chowned
            return os.lchown(path, uid, gid)
        except OSError:
            pass
        err += 'File not found'
    if err:
        return err
    return os.chown(path, uid, gid)
Main loop of the IRCConnection - reads from the socket and dispatches
dataset/ETHPy150Open saltstack/salt/salt/modules/file.py/chown--crossover with--dataset/ETHPy150Open coleifer/irc/irc.py/IRCConnection.enter_event_loop