diff options
author | Erik Johnson <palehose@gmail.com> | 2018-06-01 09:57:01 -0500 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2018-06-05 11:41:14 +0200 |
commit | ce5dfe7f95ac35263e41017c8a3c3c40c4333de3 (patch) | |
tree | 6af894febf0f2f656bf3a4270cc7382a383c30f7 | |
parent | 6c2446f24bc6a91ca907cb51d0b4a690131222d6 (diff) | |
download | gitpython-ce5dfe7f95ac35263e41017c8a3c3c40c4333de3.tar.gz |
Fix exception on import in MacOS
This is related to my fix in #658. Apparently, MacOS adds a git
executable that is just a stub which displays an error. This gets past
the try/except I added in #658, and allows all of the GitPython
components to be imported, but since the executable is not *actually*
git, it results in an exception when ``refresh()`` attemepts to run a
``git version``.
-rw-r--r-- | git/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git/__init__.py b/git/__init__.py index 74609e79..e98806d4 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -79,5 +79,8 @@ def refresh(path=None): #} END initialize git executable path ################# -refresh() +try: + refresh() +except Exception as exc: + raise ImportError('Failed to initialize: {0}'.format(exc)) ################# |