[reportlab-users] bug ? if not PIL installed - ImportError

reportlab-users@reportlab.com reportlab-users@reportlab.com
Fri, 29 Oct 2004 17:42:57 +0200


Hello 

In the Userguide is written : 
8.3 Image(filename, width=None, height=None)
Create a flowable which will contain the image defined by the data in file 
filename. The default PDF
image type jpeg is supported and if the PIL extension to Python is 
installed the other image types can also
be handled.

This is wrong. 
I had not installed PIL and i get a importerror. 
 I get a traceback. Then i have written a small test script (see below) 
and get also a failure. 

Install PIL fix the problem. 
Please correct the userguide (PIL required) or fix code (if it should work 
with jpeg). 

I am newbie. Where can/should  i report bugs ? 

martin

--------------------------------------------
 import reportlab.platypus.flowables
  File "C:\python23\lib\reportlab\platypus\__init__.py", line 9, in ?
    from reportlab.platypus.paragraph import Paragraph, 
cleanBlockQuotedText, Pa
raLines
ImportError: cannot import name Paragraph

------------------------------------------------------------------------------------
testscript: 

import reportlab.platypus.flowables
import reportlab.platypus.doctemplate

pdf = reportlab.platypus.doctemplate.SimpleDocTemplate \
            ( "filename.pdf"
            , pagesize = (595.27, 841.89)
            )
pdf_story = []
x = reportlab.platypus.flowables.Image ("dummy.jpg")
pdf_story.append (x)
pdf.build (pdf_story) 
------------------------------------------------------------------------------------

H:\TEMP>python pdf_image_test.py
Warn: Imaging Library not available, unable to import bitmaps
Traceback (most recent call last):
  File "pdf_image_test.py", line 9, in ?
    x = reportlab.platypus.flowables.Image ("dummy.jpg")
  File "C:\python23\lib\reportlab\platypus\flowables.py", line 315, in 
__init__
    self._setup(width,height,kind,0)
  File "C:\python23\lib\reportlab\platypus\flowables.py", line 327, in 
_setup
    if lazy<=0: self._setup_inner()
  File "C:\python23\lib\reportlab\platypus\flowables.py", line 333, in 
_setup_in
ner
    (self.imageWidth, self.imageHeight) = self._img.getSize()
  File "C:\python23\lib\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'

-------------------------
System Info: 
Python 2.3.4
Win2k
reportlab: current snapshot
-------------------------