[reportlab-users] problem with PIL 1.1.7 and ReportLab 2.2

Bill Janssen janssen at parc.com
Thu Dec 10 11:58:19 EST 2009


Folks, I've recently upgraded to PIL 1.1.7, and I'm suddenly seeing an
issue with ReportLab that I hadn't before. Here's my code:

c = canvas.Canvas(outputfile,
pagesize=(5 * inch, 3 * inch))
border = 0.3 * inch
x = border
y = (3 * inch) - (2 * border)
iconwidth = 0.5 * inch
iconheight = iconwidth / self._CARDIMAGEASPECT
c.drawImage(_CARDIMAGEFILEPATH,
(5 * inch - border - iconwidth),
(3 * inch - border - iconheight),
iconwidth, iconheight)

The path specified by _CARDIMAGEFILEPATH does exist and is readable and
is a valid PNG (this code has been working fine for over a year).


And here's the stack trace:

[... my frames omitted ...]
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/reportlab/pdfgen/canvas.py", line 623, in drawImage
thr008: imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/reportlab/pdfbase/pdfdoc.py", line 1994, in __init__
thr008: self.loadImageFromA85(src)
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/reportlab/pdfbase/pdfdoc.py", line 1998, in loadImageFromA85
thr008: imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG))
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/reportlab/pdfbase/pdfutils.py", line 35, in makeA85Image
thr008: raw = img.getRGBData()
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/reportlab/lib/utils.py", line 650, in getRGBData
thr008: self._dataA = ImageReader(im.split()[3])
thr008: File "/opt/GoodStuff/UpLib/lib/python2.5/site-packages/PIL/Image.py", line 1497, in split
thr008: if self.im.bands == 1:
thr008: AttributeError: 'NoneType' object has no attribute 'bands'

Anyone see what's going wrong here? What do I need to change?

If you'd like to, you can try it yourself by downloading UpLib from
http://uplib.parc.com and building it with various combos of ReportLab
and PIL.

Bill


More information about the reportlab-users mailing list