Hello guys how are you all ? Hope you all are fine. when I was clone my repo and clone successfully when i tryied repo init the source code in VM ubuntu machine I wsa found this error. SyntaxError: invalid syntax to repo init in the AOSP code
So Here is I am come with all possible solution to solve this error. So without wasting your time. Lets start this article.
What is Error ?
When I try repo init the source code I was found this error
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
Question : SyntaxError: Invalid syntax to repo init in the AOSP code
Answer : The problem is I think python version. So run the repo init with python3 and the repo you just downloaded will solve your problem.
The problem is I think python version. So run the repo init with python3 and the repo you just downloaded will solve your problem.
Just Follow below Command
- curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
- chmod a+x ~/bin/repo
- python3 ~/bin/repo init -u git@….
This will solve your issue.
To Solve this issue follow below steps
- Download last version of repo :
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > repo
- Change right to make it executable :
chmod a+x repo
- Run your repo init with python3 and the “repo” you just download :
python3 repo init -u firstname.lastname@example.org:xxx/xx_manifest.git -b xxx
Double-check you Python version between:
- your Ubuntu build machine (where the
- your VM Ubuntu machine (where the
Check here Same error here, with the error suggesting you are executing
python2 with a
PYTHONPATH that’s only appropriate for
Just modify the first line of /usr/bin/repo and change it from
This asks the system to use Python3 instead of the default Python.
So it’s all About this issue. Hope SyntaxError: invalid syntax to repo init in the AOSP code above all solution helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.