GAE read binary file into db.BlobProperty()

alex goretoy aleksandr.goretoy at gmail.com
Tue Feb 10 16:53:26 EST 2009


was not able to use open to open a binary file.... so what I did was use
urlfetch to fetch the image for me and read the content into BlobProperty()
Not sure why it took me so long to figure this out. Hope it helps someone.
thx

  def post(self,key):
    k=db.get(key)
      img=images.Image(urlfetch.Fetch("http://www.example.com/
"+k.image).content)
      img.rotate(90)
      jpg_data= img.execute_transforms(images.JPEG)
      k.image_blob=jpg_data
      k.put()

-Alex Goretoy
http://www.goretoy.com



On Mon, Feb 9, 2009 at 11:07 AM, alex goretoy
<aleksandr.goretoy at gmail.com>wrote:

> How to read Binary file into GAE(Google App Engine) db.BlobProperty()
> datastore?
>
> -Alex Goretoy
> http://www.goretoy.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090210/59470914/attachment-0001.html>


More information about the Python-list mailing list