def isalive(path):
    """
    Returns True if the file with the given name contains a process
    id that is still alive.
    Returns False otherwise.

    :type  path: str
    :param path: The name of the pidfile.
    :rtype:  bool
    :return: Whether the process is alive.
    """
    # try to read the pid from the pidfile
    pid = read(path)
    if pid is None:
        return False

    # Check if a process with the given pid exists.
    try:
        os.kill(pid, 0)  # Signal 0 does not kill, but check.
    except OSError as xxx_todo_changeme1:
        (code, text) = xxx_todo_changeme1.args
        if code == errno.ESRCH:  # No such process.
            return False
    return True
def isalive ( path ) : pid = read ( path ) if pid is None : return False try : os . kill ( pid , 0 ) except OSError as xxx_todo_changeme1 : ( code , text ) = xxx_todo_changeme1 . args if code == errno . ESRCH : return False return True
Returns True if the file with the given name contains a process
    id that is still alive.
    Returns False otherwise.

    :type  path: str
    :param path: The name of the pidfile.
    :rtype:  bool
    :return: Whether the process is alive.