def get_pgid(path, follow_symlinks=True):
 if (not os.path.exists(path)):
  return False
 if (follow_symlinks and (sys.getwindowsversion().major >= 6)):
  path = _resolve_symlink(path)
 try:
  secdesc = win32security.GetFileSecurity(path, win32security.GROUP_SECURITY_INFORMATION)
 except MemoryError:
  return 'S-1-1-0'
 except pywinerror as exc:
  if ((exc.winerror == 1) or (exc.winerror == 50)):
   return 'S-1-1-0'
  raise
 group_sid = secdesc.GetSecurityDescriptorGroup()
 return win32security.ConvertSidToStringSid(group_sid)

def get_pgid ( path , follow_symlinks = True ) : if ( not os . path . exists ( path ) ) : return False if ( follow_symlinks and ( sys . getwindowsversion ( ) . major >= 6 ) ) : path = _resolve_symlink ( path ) try : secdesc = win32security . GetFileSecurity ( path , win32security . GROUP_SECURITY_INFORMATION ) except MemoryError : return 'S-1-1-0' except pywinerror as exc : if ( ( exc . winerror == 1 ) or ( exc . winerror == 50 ) ) : return 'S-1-1-0' raise group_sid = secdesc . GetSecurityDescriptorGroup ( ) return win32security . ConvertSidToStringSid ( group_sid )
return the id of the primary group that owns a given file this function will return the rarely used primary group of a file .