Python IsGroupEmpty

rs.IsGroupEmtpy() seems to be always returning true with a valid group_name input. Fixes?

This is the code being executed

def IsGroupEmpty(group_name):
    """Verifies that an existing group is empty, or contains no object members
      group_name = the name of an existing group
      True or False if group_name exists
      None if group_name does not exist
    if not isinstance(group_name, str): group_name = str(group_name)
    index = scriptcontext.doc.Groups.Find(group_name, True)
    if index<0: return scriptcontext.errorhandler()
    return scriptcontext.doc.Groups.GroupObjectCount(index)>0


My guess is that the last line give the error, but by all means verify that by yourself. An alternative is to do for the last line

return len(scriptcontext.doc.Groups.GroupMembers(index)) > 0

Thanks, menno. Tried your suggestion with same results as before which led me to realize that the code is executing properly but that there is a semantic issue with the function; “IsGroupEmpty” should logically return true if the group is empty, and false if it is not. This implementation does the opposite so…

return not scriptcontext.doc.Groups.GroupObjectCount(index)>0

…produces the expected result.

Steve, if you’re listening how should I best go about reporting such an issue? On your git page?

edit: nevermind, the git page answered my question