[reportlab-users] Problem with GIF image

Ulrich Wisser ulrich.wisser at relevanttraffic.se
Fri Dec 10 09:19:49 EST 2004


Hello,

after moving to a new Zope and Python version, I had to look at my PDF 
code again. After figuring out how to get gdchart installed and how to 
get pygdchart2 to work, my PDF generator is the last thing to fix.

I have a temporary GIF image in the /tmp folder, it is readable.
Here is my code

         g.draw(graphfilename)
         graph=Image(graphfilename, document.pagesize[0]/2 - 2*cm, 4*cm)
         flowables.append(graph)

Why does it cause the exception? Please find details below.

Any suggestions are welcome.

Ulrich



Traceback (most recent call last):
   File "/usr/local/ZopeInstance/Extensions/pdf2.py", line 268, in pdf1
     self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html')
   File 
"/usr/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py", 
line 644, in build
     self.handle_flowable(flowables)
   File 
"/usr/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py", 
line 562, in handle_flowable
     if self.frame.add(f, self.canv, trySplit=self.allowSplitting):
   File "/usr/lib/python2.3/site-packages/reportlab/platypus/frames.py", 
line 124, in _add
     w, h = flowable.wrap(aW, h)
   File 
"/usr/lib/python2.3/site-packages/reportlab/platypus/flowables.py", line 
360, in wrap
     return (self.drawWidth, self.drawHeight)
   File 
"/usr/lib/python2.3/site-packages/reportlab/platypus/flowables.py", line 
354, in __getattr__
     self._setup_inner()
   File 
"/usr/lib/python2.3/site-packages/reportlab/platypus/flowables.py", line 
334, in _setup_inner
     if img: self.imageWidth, self.imageHeight = img.getSize()
   File "/usr/lib/python2.3/site-packages/reportlab/lib/utils.py", line 
530, in getSize
     if (self._width is None or self._height is None):
AttributeError: ImageReader instance has no attribute '_width'


More information about the reportlab-users mailing list