Windows上的Python发生Boto凭证错误 [英] Boto Credential Error with Python on Windows

查看:99
本文介绍了Windows上的Python发生Boto凭证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几个小时中,我一直在尝试通过python登录Boto,但似乎无法解决问题. Python不断返回以下错误:

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

根据记录器:

    boto.set_stream_logger('boto')

问题是:"[DEBUG]:正在从元数据服务器中检索凭证. 这必须表示找不到我的凭据文件,虽然我不确定使用访问和安全密钥将文件"mycreds.boto"确切放置在什么位置,但是我已将其复制到站点包中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() 

如果文件"mycreds.boto"不在正确"位置,我不确定如何指定该文件的路径.好像无法移动文件一样,我创建了一个环境变量"BOTO_CONFIG",其值等于"boto.config"文件的路径,该文件存储与"mycreds.boto"文件相同的凭据.不幸的是,这没有解决任何问题.最后,我尝试使用以下代码登录:

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>)

这从记录器中返回了以下内容:"[DEBUG]:使用客户端提供的访问密钥."和"[DEBUG]:使用客户端提供的密钥".它没有返回任何其他错误,但是当我尝试在线访问我的存储桶时,我无法连接.我已经尝试过多次重新启动命令窗口和计算机,但是我不确定还有什么尝试.我的想法已经用完了,因此可以提供任何帮助.我正在运行Windows 7和Python 2.7.7.

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.

推荐答案

默认情况下,boto在/etc/boto.cfg~/.boto中查找凭据.它使用os.path.expanduser尝试将~/.boto扩展到系统上的适当路径.对于Windows平台,这依赖于环境变量HOMEUSERPROFILE.如果您的环境中未设置这些变量,则可能找不到boto配置文件.

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.

您有两种选择.您可以确保在您的环境中将HOME设置为存储.boto文件的目录.或者,您可以将环境变量BOTO_CONFIG设置为直接指向您的配置文件,无论它在文件系统上的任何位置.如果您选择此选项,则应将其设置为boto配置文件的标准路径.

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?

这篇关于Windows上的Python发生Boto凭证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆