'Syntax error in python 2.7 with aws cli command
we started to getting next error :
+ aws ecr get-login --region us-east-1 --no-include-email
Traceback (most recent call last): File "/usr/local/bin/aws", line 19, in <module>
import awscli.clidriver File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
import botocore.session File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 30, in <module>
import botocore.credentials File "/usr/local/lib/python2.7/dist-packages/botocore/credentials.py", line 34, in <module>
from botocore.config import Config File "/usr/local/lib/python2.7/dist-packages/botocore/config.py", line 16, in <module>
from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 22, in <module>
from botocore.awsrequest import create_request_object File "/usr/local/lib/python2.7/dist-packages/botocore/awsrequest.py", line 26, in <module>
import botocore.utils File "/usr/local/lib/python2.7/dist-packages/botocore/utils.py", line 33, in <module>
import botocore.httpsession File "/usr/local/lib/python2.7/dist-packages/botocore/httpsession.py", line 38, in <module>
from certifi import where File "/home/ubuntu/.local/lib/python2.7/site-packages/certifi/__init__.py", line 1, in <module>
from .core import contents, where File "/home/ubuntu/.local/lib/python2.7/site-packages/certifi/core.py", line 17
def where() -> str:
^ SyntaxError: invalid syntax
Its running on jenkins slave with ubuntu 16 with default python of 2.7 and python 3.5.2 Maybe someone encountered ?
Solution 1:[1]
so we solved by upgrading ami from Ubuntu xenial 16.04 to 20 , so this way python that came with this version was already most updated and it solved our issue. Attempt of updating python on xenial 16.04 was not so successful due to 16.04 is on end life and everything is deprecated for this versions including deadsnakes ppa.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Roman margolin |
