Aws-cli: AttributeError: 'str' object has no attribute 'get'

Created on 23 Mar 2016  路  2Comments  路  Source: aws/aws-cli

I have installed awscli by:
sudo pip install awscli --ignore-installed six since I use mac os el capitan.

$ aws --version
aws-cli/1.10.15 Python/2.7.11 Darwin/15.4.0 botocore/1.4.6

$ aws s3 ls
'str' object has no attribute 'get'

$ aws s3 ls --debug

2016-03-23 13:07:35,453 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.10.15 Python/2.7.11 Darwin/15.4.0 botocore/1.4.6
2016-03-23 13:07:35,454 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['s3', 'ls', '--debug']
2016-03-23 13:07:35,454 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x103acd1b8>
2016-03-23 13:07:35,454 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x103aa21b8>
2016-03-23 13:07:35,454 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set.
2016-03-23 13:07:35,454 - MainThread - botocore.hooks - DEBUG - Event building-command-table.s3: calling handler <function add_waiters at 0x103aa2b18>
2016-03-23 13:07:35,454 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.s3.anonymous: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,455 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ls: calling handler <function add_waiters at 0x103aa2b18>
2016-03-23 13:07:35,455 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.paths: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,455 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.summarize: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,455 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.custom.ls: calling handler <awscli.argprocess.ParamShorthand object at 0x103b28790>
2016-03-23 13:07:35,456 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.anonymous: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,456 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.human-readable: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,456 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.custom.ls: calling handler <awscli.argprocess.ParamShorthand object at 0x103b28790>
2016-03-23 13:07:35,456 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.page-size: calling handler <function uri_param at 0x10381c6e0>
2016-03-23 13:07:35,456 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2016-03-23 13:07:35,456 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2016-03-23 13:07:35,456 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2016-03-23 13:07:35,456 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2016-03-23 13:07:35,486 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: s3
2016-03-23 13:07:35,495 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x103566b18>
2016-03-23 13:07:35,495 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x103566320>
2016-03-23 13:07:35,497 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 186, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/usr/local/lib/python2.7/site-packages/awscli/customizations/commands.py", line 190, in __call__
    parsed_globals)
  File "/usr/local/lib/python2.7/site-packages/awscli/customizations/commands.py", line 187, in __call__
    return self._run_main(parsed_args, parsed_globals)
  File "/usr/local/lib/python2.7/site-packages/awscli/customizations/s3/subcommands.py", line 438, in _run_main
    super(ListCommand, self)._run_main(parsed_args, parsed_globals)
  File "/usr/local/lib/python2.7/site-packages/awscli/customizations/s3/subcommands.py", line 424, in _run_main
    parsed_globals.verify_ssl)
  File "/usr/local/lib/python2.7/site-packages/awscli/customizations/s3/subcommands.py", line 417, in get_client
    config=config)
  File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 814, in create_client
    client_config=config, api_version=api_version)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 62, in create_client
    verify, credentials, scoped_config, client_config)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 182, in _get_client_args
    new_config = Config(**config_kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/config.py", line 95, in __init__
    self._validate_s3_configuration(self.s3)
  File "/usr/local/lib/python2.7/site-packages/botocore/config.py", line 132, in _validate_s3_configuration
    addressing_style = s3.get('addressing_style')
AttributeError: 'str' object has no attribute 'get'
2016-03-23 13:07:35,503 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

'str' object has no attribute 'get' 
closing-soon guidance

Most helpful comment

It looks like whatever configuration you have setup in you ~/.aws/config file is invalid. In the ~/.aws/config file a sample s3 section should look something like this (plus or minus any valid options):

s3 =
  max_concurrent_requests = 20
  max_queue_size = 10000
  multipart_threshold = 64MB
  multipart_chunksize = 16MB
  addressing_style = virtual
  signature_version = s3v4

What does your s3 section look like? My guess is that it is getting interpreted as a value as opposed to its own section in the INI file.

All 2 comments

It looks like whatever configuration you have setup in you ~/.aws/config file is invalid. In the ~/.aws/config file a sample s3 section should look something like this (plus or minus any valid options):

s3 =
  max_concurrent_requests = 20
  max_queue_size = 10000
  multipart_threshold = 64MB
  multipart_chunksize = 16MB
  addressing_style = virtual
  signature_version = s3v4

What does your s3 section look like? My guess is that it is getting interpreted as a value as opposed to its own section in the INI file.

In my configs I had:

  s3 =
     signature_version = s3v4

The issue was fixed with configs mentioned above. @kyleknap thank you :)

Was this page helpful?
0 / 5 - 0 ratings