iter() returned non-iterator of type 'Key' : boto amazon s3

China☆狼群 提交于 2019-12-25 01:16:51

问题


I am new to boto I was trying out the tutorial at this link

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

However every time I try to retrieve an item an error occurs. My code is follows:

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)

I get the following error:

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'

I copied the code almost only thing is my s3 keys are different.

来源:https://stackoverflow.com/questions/17374151/iter-returned-non-iterator-of-type-key-boto-amazon-s3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!