python - GitPython: check if git is available -
gitpython depends on having command line version of git
installed (otherwise, issue in question: oserror: [errno 2] no such file or directory on gitpython).
is there way gitpython api check if executable found, or, need wrap gitpython calls in exception handling account possibility?
i don't particularly recommend this, did @ least once: try 1 git command while catching oserror case see if can run git (and running it, capture git version number well, in case). if git fails run, complain , disable further invocations of git (or exit or whatever). if not, assume further invocations continue work.
Comments
Post a Comment