Description
Because "git.cmd" is in PATH and not "git"
I wrote an email to mailing list about it.
The exception:
import git
git.Git().help()
WindowsError Traceback (most recent call last)
C:\Program Files\Support Tools in ()
C:\python\lib\site-packages\gitpython-0.3.1-py2.6.egg\git\cmd.pyc in (_args, *kwargs)
217 if name[:1] == '':
218 raise AttributeError(name)
--> 219 return lambda _args, *_kwargs: self._call_process(name, _args, *_kwargs)
220
221 @Property
C:\python\lib\site-packages\gitpython-0.3.1-py2.6.egg\git\cmd.pyc in _call_process(self, method, _args, *_kwargs)
428 call.extend(args)
429
--> 430 return self.execute(call, **_kwargs)
431
432 def _parse_object_header(self, header_line):
C:\python\lib\site-packages\gitpython-0.3.1-py2.6.egg\git\cmd.pyc in execute(self, command, istream, with_keep_cwd, with_extended_output, with_exceptions, as_process, output_stream, *_subprocess_kwargs)
307 stdout=PIPE,
308 close_fds=(os.name=='posix'),# unsupported on linux
--> 309 *_subprocess_kwargs
310 )
311 if as_process:
C:\python\python26.zip\subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
593 p2cread, p2cwrite,
594 c2pread, c2pwrite,
--> 595 errread, errwrite)
596
597 if mswindows:
C:\python\python26.zip\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
802 env,
803 cwd,
--> 804 startupinfo)
805 except pywintypes.error, e:
806 # Translate pywintypes.error to WindowsError, which is
Fix
Changing line 427 in cmd.py from "git" to "git.cmd" solved this locally.
Need a better solution, e.g.
- try: except WindowError:
- check if platform.system() == "Windows"
- search for git or git.cmd in PATH
- etc.