Is is possible to read a file from S3 in Google App Engine using boto?

You don't need to write to a file or a StringIO at all. You can call key. Get_contents_as_string() to return the key's contents as a string.

The docs for key are here.

Thanks Nick. This works, and without having to import the StringIO module. I think for obvious reasons that makes it a better solution.

For anyone following along at home, I changed the pickle. Load(content) to pickle. Loads(content) to work with unpickling a string-like, rather than file-like, object.

– rd108 Oct 19 '10 at 0:45.

You can write into a blob and use the StringIO to retrieve the data from boto. S3. Connection import S3Connection from boto.

S3. Key import Key from google.appengine. Ext import db class Data(db.

Model) image = db. BlobProperty(default=None) conn = S3Connection(config. Key, config.

Secret_key) bucket = conn. Get_bucket('bucketname') key = bucket. Get_key("picture.

Jpg") fp = StringIO.StringIO() key. Get_file(fp) data = Data(key_name="picture. Jpg") data.

Image = db. Blob(fp.getvalue()) data.put().

Thanks, this works. Using StringIO was a great idea. – rd108 Oct 16 '10 at 22:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions