问题
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