()
Gets the .local hostname.

  Returns:
    string with local hostname, 'noname' if none is set.
Gets the .local hostname.
Gets the . local hostname .
def GetLocalHostname():
  """Gets the .local hostname.

  Returns:
    string with local hostname, 'noname' if none is set.
  """
  session = SCPreferencesCreate(None, 'gmacpyutil', None)
  try:
    hostname = SCPreferencesPathGetValue(
        session,
        '/System/Network/HostNames/')['LocalHostName']
  except TypeError:
    # LocalHostName (scutil --get LocalHostName) is not set.
    hostname = None
  if hostname:
    return hostname
  else:
    return 'noname'
def GetLocalHostname ( ) : session = SCPreferencesCreate ( None , 'gmacpyutil' , None ) try : hostname = SCPreferencesPathGetValue ( session , '/System/Network/HostNames/' ) [ 'LocalHostName' ] except TypeError : # LocalHostName (scutil --get LocalHostName) is not set. hostname = None if hostname : return hostname else : return 'noname'