Brad
Brad

Reputation: 51

Boto Credential Error with Python on Windows

I have been working on trying to sign in on Boto via python for the last few hours and can't seem to solve the problem. Python keep returning the error that:

    No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler']
    Check your Credentials

According to the logger:

    boto.set_stream_logger('boto')

The problem is: "[DEBUG]: Retrieving credentials from metadata server." This must mean my credentials file cannot be found, and while I am not sure exactly where to place my file "mycreds.boto" with my access and security key, I have copied it to several location in the boto directory within my site-packages. I have searched extensively and am unsure where to place this file. Given the fact that:

      s3 = boto.connect_s3() 

I am unsure how I would specify the path to my file "mycreds.boto" if it wasn't in the "correct" location. Seeing as how moving the file around did not work I have created an environmental variable "BOTO_CONFIG" with a value equal to the path to a "boto.config" file that stores the same credentials as my "mycreds.boto" file. This unfortunately did not solve any issues. Finally I have tried logging in using this code:

      s3 = boto.connect_s3(<aws access>, <aws secret key>)

This returned the following from the logger: "[DEBUG]:Using access key provided by client." and "[DEBUG]:Using secret key provided by client." It did not return any other errors, but when I tried to access my buckets online I was unable to connect. I have tried restarting my Command windows and computer multiple times and I am not sure what else to try. I have basically run out of ideas, so any help would be appreciated. I am running Windows 7 and Python 2.7.7.

Upvotes: 3

Views: 2887

Answers (1)

garnaat
garnaat

Reputation: 45906

By default, boto looks for credentials in /etc/boto.cfg and in ~/.boto. It uses os.path.expanduser to try to expand ~/.boto into the appropriate path on your system. For Windows platforms, this relies on the environment variables HOME and USERPROFILE. If neither of these variables are set in your environment, it probably won't find the boto config file.

You have a couple of options. You could make sure that HOME is set in your environment to the directory in which your .boto file is stored. Or, you could set the environment variable BOTO_CONFIG to point directly to your config file, wherever it is on your file system. If you take this option it should be set to the fully qualified path to your boto config file.

I'm not sure why supplying the credentials directly did not work for you. Could you provide more information about how it's failing? Are you getting an error message? If so, what?

Upvotes: 2

Related Questions