2

I have lately installed python-git package, and when trying to follow the tutorials over at the following link, I find that certain methods are missing...

http://packages.python.org/GitPython/0.3.2/tutorial.html#tutorial-label

Here is what came out of my interpreter:

>>> from git import *
>>> repo = Repo.init('/home/deostroll/scripts/synchost')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'Repo' has no attribute 'init'
>>> repo = Repo('/home/deostroll/scripts/synchost')
>>> repo.is_dirty()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
>>> 
1
  • am I looking at an outdated version of the tutorial? Commented Jul 7, 2012 at 18:12

2 Answers 2

2

Those commands work for me, so I agree with the other answer that you're probably using an outdated version. If you're on linux and have PIP, installed, on the command line you can do:

pip install --upgrade GitPython

to upgrade to the latest version. (Sidenote: for me on Fedora, the command is actually pip-python, so it depends on your distro).

2

It seems likely that you're using a very outdated verison of GitPython. In version 0.3, is_dirty is a method, and init exists.

In version 0.1, is_dirty is a property, and init_bare is defined, but not init.

1
  • I got this from the ubuntu software centre...and yes the version is outdated! Commented Jul 7, 2012 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.