I am having a python script like below in a file git.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from git import Repo
git_path = "test"
repo = Repo(git_path)
assert not repo.bare
Python version is : Python 2.7.12
OS : Description: Ubuntu 16.04.1 LTS
Gitpython - 2.1.7
I am getting the below error when i run python git.py
Traceback (most recent call last):
File "git.py", line 4, in <module>
from git import Repo
File "/home/user/demo_files/git.py", line 4, in <module>
from git import Repo
ImportError: cannot import name Repo
I have checked most of the links ,available not able to resolve my issue. Please help me.
asked Nov 8, 2017 at 10:41
robin
1,9251 gold badge19 silver badges47 bronze badges
1 Answer 1
Change your file name from git.py to othername .py, since your file is referring to itself it is throwing error
Sign up to request clarification or add additional context in comments.
Comments
lang-py
git.py.