From ba1537ed58edb47427a061aa724f0824f8423436 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Wed, 26 Jul 2023 07:29:35 -0400 Subject: [PATCH] check for pyobjc before using it --- ids/profile.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ids/profile.py b/ids/profile.py index 2b9158e..52d6cb4 100644 --- a/ids/profile.py +++ b/ids/profile.py @@ -50,8 +50,16 @@ def get_auth_token( ) -> tuple[str, str]: from sys import platform - # if use_gsa: - if platform == "darwin": + use_gsa = False + # Check if objc is importable + try: + if platform == "darwin": + import objc + use_gsa = True + except ImportError: + pass + + if use_gsa: logger.debug("Using GrandSlam to authenticate (native Anisette)") g = gsa.authenticate(username, password, gsa.Anisette()) pet = g["t"]["com.apple.gs.idms.pet"]["token"]