Add import error handling and clean CLI menu

This commit is contained in:
Mykola Grymalyuk
2021-09-04 22:31:20 -06:00
parent 077af5afb3
commit d4836514fd
8 changed files with 278 additions and 182 deletions
+10 -1
View File
@@ -4,8 +4,17 @@
from __future__ import annotations
from typing import NewType, Union
import subprocess
try:
import objc
except ImportError:
subprocess.run(["pip3", "install", "pyobjc"], stdout=subprocess.PIPE)
try:
import objc
except ImportError:
raise Exception("Missing PyObjc library!\nPlease run the following before starting OCLP:\npip3 install pyobjc")
import objc
from CoreFoundation import CFRelease, kCFAllocatorDefault # type: ignore # pylint: disable=no-name-in-module
from Foundation import NSBundle # type: ignore # pylint: disable=no-name-in-module
from PyObjCTools import Conversion