0

I'm on ubuntu 18.04 and I'm trying to init this repo :

# repo init -u https://github.com/anbox/platform_manifests.git -b anbox

since I'm using this version of python :

# python
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux

it 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 str

so 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 linux2

but even this time it does not work :

# repo init -u https://github.com/anbox/platform_manifests.git -b anbox
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
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 https://gerrit.googlesource.com/git-repo
   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 syntax

what else I can do ?

2
  • It looks like what ever this is you are trying to do from github wants an older version of python. Python 3.6 is the default version that comes with Ubuntu 18.04/18.10 But the latest version is Python 3.8.20 Dec 2019
    – David
    Mar 20, 2021 at 12:12
  • I tried a lot of versions of python. even the 2.6 does not work.
    – Marietto
    Mar 20, 2021 at 19:20

1 Answer 1

1

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 https://github.com/anbox/platform_manifests.git -b anbox

If not set, first set your git name and email or you run into new errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.