본문 바로가기
IT/IT 잡지식

Repo Init 에러 해결 하기

by 큰공 2021. 1. 14.
728x90
반응형


들어가며

 신규 개발 서버에 Repo init 으로 세팅하려고 하였는데, 아래와 같은 에러메시지가 출력되어 이를 해결하는 방법에 대해서 기술하고자 한다.

 

SyntaxError: invalid syntax

 repo init 시 아래와 같은 에러가 발생하였다.

$repo init -u https://bitbucket.xxxx.xxxx.manifest" -b xxx
File "/xxx/.repo/repo/main.py", line 79
    file=sys.stderr)

        ^

SyntaxError: invalid syntax

 

 파이썬 코드에서 에러가 발생하므로, 파이썬 코드 자체에서 뭔가 문제가 있지 않을까 하는 방향을 생각하면 오산이다. 저 코드를 찾아서 주석처리하거나, 지우거나 하는것은 해결방법이 아니다.

 

파이썬 버젼 업그레이드

 파이썬 버젼이 2.x 이여서, 파이썬 자체의 문법이 변경되었는데, 이것이 업데이트가 되지 않아 이와 같은 이슈가 발생한다.

 아래와 같이 하여 파이썬 버젼을 업그레이드 하자. 파이썬 버젼 업그레이드는 이전 게시물을 참고하는것도 도움이 된다.

 아래 명령을 수행해서 python 3 최신버젼으로 설치하자.


$ sudo apt-get install python3 python3-pip python3-pexpect python3-git python3-jinja2

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1

2020/12/07 - [IT/IT 잡지식] - 파이썬 버전 업그레이드 후 버젼별 사용 설정하기

 

파이썬 버전 업그레이드 후 버젼별 사용 설정하기

개요 리눅스 환경 빌드시스템 구축 중 아래와 같은 에러메시지가 출력될때, 파이썬 업그레이드를 하는 방법에 대해서 기술한다.  repo: warning: Python 2 is no longer supported; Please upgrade to Python 3...

coinpipe.tistory.com

 

REPO TYPE ERROR

 파이썬을 업데이트 했지만, 또 아래와 같은 TypeError 가 발생한다. 해당 에러는 repo 의 버젼이 이전 버젼이여서 발생하는 현상으로 repo 자체를 업그레이드 해주면 됩니다.

 "TypeError: startswith first arg must be bytes or a tuple of bytes, not str" 에러는 repo 버젼을 업그레이드 하자.


repo: warning: Python 2 is no longer supported; Please upgrade to Python 3...
Traceback (most recent call last): File "/home/username/bin/repo", line 738, in <module>

   main(sys.argv[1:])
File "/home/username/bin/repo", line 705, in main
    _Init(args)
File "/home/username/bin/repo", line 234, in _Init _CheckGitVersion()
File "/home/username/bin/repo", line 274, in _CheckGitVersion
    if not ver_str.startswith('git version '): 

 TypeError: startswith first arg must be bytes or a tuple of bytes, not str

 

 

 

REPO 업그레이드 (신규 설치)

아래 커맨드로 repo 를 최신으로 설치 하자.


$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

 repo 를 PATH 에 등록해서 어디서든지 사용할 수 있도록 하자.


$ vim ~/.bashrc

  export PATH="~/bin:$PATH" # 끝 쭐에 추가

 

맺으며

 

repo init 수행 중에,

"SyntaxError: invalid syntax",

"TypeError: startswith first arg must be bytes or a tuple of bytes, not str"

발생시에는 repo 를 최신으로 설치하고,

파이썬을 3.x 의 최신버젼으로 설치하자.

 

 

 

 

 

728x90
반응형

댓글