After installing with awscli with pip and running aws --version, or any other aws command, I receive this error:
/Users/
print '%(name)s: %(endpoint)s' % {
^
SyntaxError: invalid syntax
The entire function from that error is as follows:
def list_regions(service):
"""
List regions for the service
"""
for region in service.regions():
print '%(name)s: %(endpoint)s' % {
'name': region.name,
'endpoint': region.endpoint,
}
I am using an anaconda environment, with python 2.7. However it appears main.py is running under python 3.6 from the error. I also tried installing and running in my regular environment with 3.6 and had the same error as well.
I don't see this list_regions
function in the codebase. This seems to be custom code of some sort.
If you're hitting python 3, print
needs to have parens. Some details can be found in this SO answer.
This appears to be an issue with something other than this code base. The importable name for this tool is awscli
not aws
Leaving this here in case someone comes across this via google like me:
I had the same issue with the same environment (anaconda environment with python 3.6). This is actually a different package, confusingly named "aws" which is throwing the error: https://github.com/eofs/aws
Make sure you run pip install awscli
, NOT pip install aws
. You may want to confirm which "aws" package you are calling via which aws
.
Remove the aws package with pip uninstall aws
. Then install awscli, pip install awscli
.
eze1981, that worked. Thanks pal :)
I installed AWSCLI using pip install awscli command but still got this error. It got resolved after upgrading the aws with the command pip install --upgrade awscli
I had to do a --force-reinstall
after forgetting that I already had awscli
installed, installing aws
and then uninstalling aws
. This removed the aws
binary, hence the need for the --force-reinstall
In my case, I tried all the options highlighted and it still resulted in the same error until I did the following:
aws
binary installed which aws
and rm the file.@HUU Thanks dude, you saved my day 馃憤
Most helpful comment
Leaving this here in case someone comes across this via google like me:
I had the same issue with the same environment (anaconda environment with python 3.6). This is actually a different package, confusingly named "aws" which is throwing the error: https://github.com/eofs/aws
Make sure you run
pip install awscli
, NOTpip install aws
. You may want to confirm which "aws" package you are calling viawhich aws
.