Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoCredentialsError' object has no attribute 'message' #224

Open
fxcoudert opened this issue Oct 12, 2018 · 1 comment
Open

Comments

@fxcoudert
Copy link

While running credstash with the latest version of all its dependencies on Python 3 (as part of Homebrew testing), there is an error that it not caught correctly:

$ credstash put test test                                     
Traceback (most recent call last):
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 79, in generate_key_data
    KeyId=self.key_id, EncryptionContext=self.encryption_context, NumberOfBytes=number_of_bytes
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/client.py", line 320, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/client.py", line 610, in _make_api_call
    operation_model, request_dict)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/signers.py", line 157, in sign
    auth.add_auth(request)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/lib/python3.7/site-packages/botocore/auth.py", line 356, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/credstash", line 11, in <module>
    load_entry_point('credstash==1.15.0', 'console_scripts', 'credstash')()
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 916, in main
    putSecretAction(args, region, **session_params)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 246, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 387, in putSecretAction
    **session_params):
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 297, in putSecret
    digest_method=digest,
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 613, in seal_aes_ctr_legacy
    key, encoded_key = key_service.generate_key_data(64)
  File "/usr/local/Cellar/credstash/1.15.0_1/libexec/bin/credstash.py", line 82, in generate_key_data
    raise KmsError("Could not generate key using KMS key %s (Detail: %s)" % (self.key_id, e.message))
AttributeError: 'NoCredentialsError' object has no attribute 'message'
@rseuchter
Copy link

Exceptions no longer have a message attribute in Python 3. See PEP 352. I just hit a similar issue running some code in Python 3 that's trying to access message. I found this bug you opened during my research about the reason of the problem.

Unfortunately neither the Python 2 docs nor the Python 3.7 docs mention this so I found it rather difficult to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants