[reportlab-users] Appengine - Reportlab (Get Photo from Model)

Martinho Arantes martinhoarantes at gmail.com
Tue Oct 5 03:45:53 EDT 2010

Hi, i forgot to tell that i´m resizing the images. I made a handler to
upload the image. As far as i know, Google App Engine doesn´t support PIL,
because of low-level (C dependencies), but App Engine accepts images through
the Images Library. I commented the code for upload the image to the
Blobstore and included the same image from my source folder directly. I
wouldn´t say that the image is corrupt.

Please, take a look at the image i uploaded to this site

2010/10/5 Henning von Bargen <H.vonBargen at t-p.com>

> > I?m getting errors like this one:

> > File "C:\Users\hp\workspace\x-ray\src\principal.py", line 441, in post

> > image = canvas.ImageReader(StringIO.StringIO(user.photo)) File

> > "reportlab.zip\reportlab\lib\utils.py", line 588, in *init* File

> > "reportlab.zip\reportlab\lib\utils.py", line 582, in *init* RuntimeError:

> > Imaging Library not available, unable to import bitmaps only jpegs

> > fileName=<StringIO.StringIO instance at 0x04A5A030>

> > identity=[ImageReader at 0x4a62290].


> Look at the exception traceback. A RuntimeError is thrown in utils.py.


> The following code in utils.py is bad coding style IMHO

> as it hides the actual cause and results in a possibly misleading message:


> class ImageReader(object):

> ...

> def __init__(self, fileName):

> ...

> if haveImages:

> ...

> else:

> from reportlab.pdfbase.pdfutils import readJPEGInfo

> try:

> self._width,self._height,c=readJPEGInfo(self.fp)

> except:

> raise RuntimeError('Imaging Library not available,

> unable to import bitmaps only jpegs')

> ...


> For a test, you should remove the exception handling shown here.

> Then you'll see what exactly goes wrong in pdfutils.readJPEGInfo.


> Just to be sure, you should also dump the actual blob content to a file.

> Maybe it has a jpeg file suffix but isn't standard JPEG?



> Henning

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20101005/a1ab73a0/attachment.htm>

More information about the reportlab-users mailing list