()
Checks if console is test only or GUI.

  Returns:
    True if the console is text-only, False if GUI is available
Checks if console is test only or GUI.
Checks if console is test only or GUI .
def IsTextConsole():
  """Checks if console is test only or GUI.

  Returns:
    True if the console is text-only, False if GUI is available
  """
  try:
    # see TN2083
    security_lib = ctypes.cdll.LoadLibrary(
        '/System/Library/Frameworks/Security.framework/Security')

    # Security.Framework/Headers/AuthSession.h
    session = -1
    session_id = ctypes.c_int(0)
    attributes = ctypes.c_int(0)

    ret = security_lib.SessionGetInfo(
        session, ctypes.byref(session_id), ctypes.byref(attributes))

    if ret != 0:
      return True

    return not attributes.value & SESSIONHASGRAPHICACCESS
  except OSError:
    return True
def IsTextConsole ( ) : try : # see TN2083 security_lib = ctypes . cdll . LoadLibrary ( '/System/Library/Frameworks/Security.framework/Security' ) # Security.Framework/Headers/AuthSession.h session = - 1 session_id = ctypes . c_int ( 0 ) attributes = ctypes . c_int ( 0 ) ret = security_lib . SessionGetInfo ( session , ctypes . byref ( session_id ) , ctypes . byref ( attributes ) ) if ret != 0 : return True return not attributes . value & SESSIONHASGRAPHICACCESS except OSError : return True