neither python 3 nor python 2 works well on ubuntu 18.04 with repo?
I'm on ubuntu 18.04 and I'm trying to init this repo :
# repo init -u -b anboxsince I'm using this version of python :
# python
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linuxit does not work. it says :
warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
Traceback (most recent call last): File "/usr/bin/repo", line 886, in <module> main(sys.argv[1:]) File "/usr/bin/repo", line 854, in main _Init(args, gitc_init=(cmd == 'gitc-init')) File "/usr/bin/repo", line 340, in _Init _CheckGitVersion() File "/usr/bin/repo", line 394, in _CheckGitVersion ver_act = ParseGitVersion(ver_str) File "/usr/bin/repo", line 364, in ParseGitVersion if not ver_str.startswith('git version '):
TypeError: startswith first arg must be bytes or a tuple of bytes, not strso ok. I created a symlink to python 2.7 :
# ln -s /usr/bin/python2.7 /usr/bin/python
root@ziomario-Z390-AORUS-PRO:/home/ziomario/Scrivania/Data/Nano/I9/anbox-work# python
Python 2.7.17 (default, Feb 27 2021, 15:10:58)
[GCC 7.5.0] on linux2but even this time it does not work :
# repo init -u -b anbox
Get
Get
remote: Counting objects: 8, done
remote: Finding sources: 100% (142/142)
remote: Total 142 (delta 64), reused 142 (delta 64)
Ricezione degli oggetti: 100% (142/142), 137.91 KiB | 4.18 MiB/s, done.
Risoluzione dei delta: 100% (64/64), completed with 14 local objects.
Da ceba2dd..323b113 main -> origin/main b64bec6..511a0e5 stable -> origin/stable * [nuova tag] v2.13 -> v2.13 * [nuova tag] v2.13.1 -> v2.13.1 * [nuova tag] v2.13.2 -> v2.13.2 * [nuova tag] v2.13.3 -> v2.13.3 * [nuova tag] v2.13.4 -> v2.13.4 * [nuova tag] v2.13.5 -> v2.13.5 * [nuova tag] v2.13.6 -> v2.13.6 * [nuova tag] v2.13.7 -> v2.13.7 File "/home/ziomario/Scrivania/Data/Nano/I9/anbox-work/.repo/repo/main.py", line 79 file=sys.stderr) ^
SyntaxError: invalid syntaxwhat else I can do ?
21 Answer
After you have run the command under python2, there will be an update of the repo script available, capable of handling python3. Its location is .repo/repo/repo, with respect to the directory where you executed the command. Change your python version back to python3 and, in that folder, run :
.repo/repo/repo -u -b anboxIf not set, first set your git name and email or you run into new errors.