SyntaxError: invalid syntax to repo init in the AOSP code

GNK picture GNK · Dec 8, 2020 · Viewed 21.1k times · Source

I have tried to repo init the source code Ubuntu build machine and it is successfully able to clone the code.

repo init -u [email protected]:xxx/xx_manifest.git -b xxx

Now I am trying repo init the source code in VM Ubuntu machine.

In between getting the error like below:

Traceback (most recent call last):
 File "/xxx/.repo/repo/main.py", line 56, in <module>
from subcmds.version import Version
 File "/xxx/.repo/repo/subcmds/__init__.py", line 38, in <module>
['%s' % name])
 File "/xxx/.repo/repo/subcmds/upload.py", line 27, in <module>
from hooks import RepoHook
File "/xxx/.repo/repo/hooks.py", line 472
file=sys.stderr)
    ^
 SyntaxError: invalid syntax

python version is same in build machine and vm machine 2.7.17.

Answer

skrrt picture skrrt · Dec 8, 2020

try these commands

curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo
python3 ~/bin/repo init -u git@....