Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: 'GitlabService' object has no attribute 'gl' and other errors #173

Closed
doronbehar opened this issue Aug 1, 2017 · 7 comments
Assignees
Labels

Comments

@doronbehar
Copy link

I can't make a single command of git repo work, I haven't tested a lot yet because even git repo lab open doesn't work for me yet. I guess it's a problem with my configuration?

Here is the TraceBack for the error I get:

$ me ~/repos/git-repo $ git repo lab
Fatal error: 'GitlabService' object has no attribute 'gl'                                                                                                                                                          
------------------------------------                                                                                                                                                                               
Traceback (most recent call last):
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/repo.py", line 546, in main
    return GitRepoRunner(args).run()
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/kwargparse.py", line 68, in run
    return self._action_dict[frozenset(args)](self)
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/repo.py", line 396, in do_open
    self.get_service(lookup_repository=self.repo_slug is None).open(self.user_name, self.repo_name)
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/repo.py", line 204, in get_service
    service = RepositoryService.get_service(repository, self.target)
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/service.py", line 126, in get_service
    cls._current = service(repository, config)
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/ext/gitlab.py", line 22, in __init__
    super().__init__(*args, **kwarg)
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/service.py", line 168, in __init__
    self.connect()
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/ext/gitlab.py", line 26, in connect
    self.gl.set_url(self.url_ro)
AttributeError: 'GitlabService' object has no attribute 'gl'

I installed it in a virtualenv from the gitlab repository.
I tried to use the github repository and no luck either:

Traceback (most recent call last):
  File "/home/doron/.local/bin/git-repo", line 7, in <module>
    from git_repo.repo import cli
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/repo.py", line 139, in <module>
    from .services.service import RepositoryService
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/service.py", line 607, in <module>
    from .ext import *
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/git_repo/services/ext/bitbucket.py", line 10, in <module>
    from pybitbucket.bitbucket import Client, Bitbucket
  File "/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/pybitbucket/bitbucket.py", line 25, in <module>
    from uritemplate import expand                                                                                                                                                                                 
ModuleNotFoundError: No module named 'uritemplate'

I also tried installing the release version (pip install git-repo - without the path to the local git repo I have on my machine) and I get the same error as above.

Any solutions? I would like very to use this piece of software because it looks very promising..

@guyzmo
Copy link
Owner

guyzmo commented Aug 2, 2017

Hello, for the try from the sources repository with virtualenv (and the pip install git-repo, have you followed the README and did a git-repo config config first?
For the second try, have you made sure you installed all the dependencies?

I would like very to use this piece of software because it looks very promising..

thank you, and I hope you'll like it! ☺

@guyzmo guyzmo added the question label Aug 2, 2017
@guyzmo guyzmo self-assigned this Aug 2, 2017
@doronbehar
Copy link
Author

OK, I've just succeeded in making it work by ln -s ~/.config/git/config ~/.gitconfig. I guess it's just on of the problems that occur from #153.
Besides that, I use the environmental variables $PRIVATE_KEY_GIT{LAB,HUB} instead of hard-coding my keys in my configuration file (I share it on a public git repository..) and I get these messages:

/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/gitlab/__init__.py:241: DeprecationWarning: set_url() is deprecated, create a new Gitlab instance if you need an updated URL.
  DeprecationWarning)
/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/gitlab/__init__.py:276: DeprecationWarning: set_token() is deprecated, use the private_token argument of the Gitlab constructor.
  DeprecationWarning)
/home/doron/.virtualenv/git-repo/lib/python3.6/site-packages/gitlab/__init__.py:206: DeprecationWarning: token_auth() is deprecated and will be removed.
  DeprecationWarning)

I guess these are related to the gitlab dependency so it's not part of your work. Is there a way to hide those warnings?

@guyzmo
Copy link
Owner

guyzmo commented Aug 4, 2017

well, either you force install a former version of python-gitlab or you wait for an update. I made a PR on python-gitlab to support dependency injection, so that the above methods are not needed anymore for git-repo.

@guyzmo
Copy link
Owner

guyzmo commented Aug 4, 2017

for the keys, to enable storage of your gitconfig in a repository, you can use an include of your keys in another external files. Though, as #153 states, then the configuration won't work anymore. So my advice is that you generate all the tokens using the git repo config tool, then once you're set you can extract them using:

python -m git_repo.extract_config ~/.config/git/config-services ~/.config/git/config

to generate the ~/.config/git/config-services that will contain all the services configurations, including the tokens.

@doronbehar
Copy link
Author

Hmm, Could you provide a link please to that PR? I couldn't find it on guyzmo/python-gitlab.

@guyzmo
Copy link
Owner

guyzmo commented Aug 4, 2017

it's #170 here referencing python-gitlab/python-gitlab#280

@guyzmo
Copy link
Owner

guyzmo commented Nov 18, 2017

Finally solved! Sorry for the lengthy delay, they released my patch for dep injection back in september, and today I released a new version that implements the git-repo side of the patch.

@guyzmo guyzmo closed this as completed Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants