iter()返回'Key'类型的非迭代器:boto amazon s3

时间:2013-06-28 21:45:15

标签: python amazon-s3 boto

我是boto的新手我在这个链接上试用了这个教程

    http://boto.s3.amazonaws.com/s3_tut.html

但是,每次尝试检索项目时都会发生错误。 我的代码如下:

conn=boto.connect_s3(KEY,PRIVATEKEY) 
bucket= conn.create_bucket(bucketname)
from boto.s3.Key import Key
k= Key(bucket,'key')
k.get_contents_to_file(filename)

我收到以下错误:

k.get_contents_to_file('test')
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
k.get_contents_to_file('test')
File "C:\Python33\lib\site-packages\boto\s3\key.py", line 1253, in get_contents_to_file
response_headers=response_headers)
File "C:\Python33\lib\site-packages\boto\s3\key.py", line 1149, in get_file
for bytes in self:
TypeError: iter() returned non-iterator of type 'Key'

我复制的代码几乎只有我的s3键不同。

0 个答案:

没有答案