3

GitPython depends on having the command line version of git installed (otherwise, you get the issue in this question: OSError: [Errno 2] No such file or directory on GitPython).

Is there any way from the GitPython API to check if the executable is found, or, do you need to wrap all GitPython calls in exception handling to account for this possibility?

Community
  • 1
  • 1
MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78

1 Answers1

1

I don't particularly recommend this, but I actually did it at least once: try one git command while catching the OSError case to see if you can run git (and by running it, capture the git version number as well, in my case). If git fails to run, complain and disable further invocations of git (or exit immediately or whatever). If not, assume further invocations will continue to work.

torek
  • 448,244
  • 59
  • 642
  • 775