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

Robin Becker robin at reportlab.com
Tue Oct 5 04:55:34 EDT 2010


On 05/10/2010 08:45, Andy Robinson wrote:

> On 5 October 2010 08:20, Henning von Bargen<H.vonBargen at t-p.com> wrote:

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

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

>>

>> 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')

>> ...

>

> I agree completely. If PIL cannot be imported, readJPEGInfo should

> raise an exception saying so. If it's otherwise unexpected 'bad JPEG

> data' it should either say so or raise the naked exception.

>

> I guess we could fix this and write a unit test to verify appropriate

> exceptions occur..

>

> - Andy

.......
luckily we have added annotateException which should allow us to modify the
existing exception and provide some more information

To the OP you could try changing

raise RuntimeError('Imaging Library not available, unable to import bitmaps only
jpegs')

into

annotateException('\nImaging Library not available, unable to import bitmaps
only jpegs')

and see if that helps to get more information.
--
Robin Becker


More information about the reportlab-users mailing list