无法读取实例数据,从而放弃python boto中的错误 [英] Unable to read instance data, giving up error in python boto

查看:114
本文介绍了无法读取实例数据,从而放弃python boto中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Boto库访问Amazon s3,以访问亚马逊"aws-publicdatasets"中可用的常见爬网数据.

I am trying to access amazon s3 using boto library to access common crawl data availble in amazon 'aws-publicdatasets'.

我在〜/.boto中创建了访问配置文件

i created access config file in ~/.boto

[Credentials]
aws_access_key_id = "my key"
aws_secret_access_key = "my_secret"

并在与Amazon S3建立连接时,我在日志中看到以下错误.

and while creating connection with amazon s3 i see below error in logs.

2014-01-23 16:28:16,318 boto [DEBUG]:Retrieving credentials from metadata server.
2014-01-23 16:28:17,321 boto [ERROR]:Caught exception reading instance data
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/boto-2.13.3-py2.6.egg/boto/utils.py", line 211, in retry_url
    r = opener.open(req)
  File "/usr/lib64/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
    raise URLError(err)
URLError: <urlopen error timed out>
2014-01-23 16:28:17,323 boto [ERROR]:Unable to read instance data, giving up

另一种方式是我尝试在创建连接对象时提供凭据,如下所示

In other way I tried to give credentials while creating connection object also as shown below

from boto.s3.connection import S3Connection
from boto.s3.bucket import Bucket
boto.set_stream_logger('boto')
connection = S3Connection('______','__________')    
bucket = Bucket(connection.get_bucket('aws-publicdatasets'))

仍然在日志中看到相同的错误

Still i am seeing the same error in logs

推荐答案

在与脚本相同的文件夹中使用.boto文件时,我遇到了相同的错误.它必须位于主文件夹的基础上.

I had the same error when using a .boto file in the same folder as the script. It has to be on the base of the home folder.

这篇关于无法读取实例数据,从而放弃python boto中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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