From: Daniel Lenski Date: Sun, 29 Mar 2020 16:53:03 +0000 (-0700) Subject: use either PyGObject (import gi, maintained) or pgi (import pgi, old/unmaintained) X-Git-Url: https://code.communitydata.science/nu-vpn-proxy.git/commitdiff_plain/6133ffeb7a47a12afff2e7eb404434d24ddc01e1?ds=sidebyside;hp=--cc use either PyGObject (import gi, maintained) or pgi (import pgi, old/unmaintained) ping #7 --- 6133ffeb7a47a12afff2e7eb404434d24ddc01e1 diff --git a/gp-saml-gui.py b/gp-saml-gui.py index 54d14c2..d6f8f15 100755 --- a/gp-saml-gui.py +++ b/gp-saml-gui.py @@ -1,6 +1,15 @@ #!/usr/bin/env python3 -import gi +try: + import gi +except ImportError: + try: + import pgi as gi + except ImportError: + gi = None +if gi is None: + raise ImportError("Either gi (PyGObject) or pgi module is required.") + import argparse import pprint import urllib diff --git a/requirements.txt b/requirements.txt index 6279bc3..80ea7da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ requests -pgi +pygobject