[reportlab-users] Image: jpeg_fh crashing

Marek Kubica pythonmailing at web.de
Mon Aug 27 15:48:54 EDT 2007


Hi!

When I add an image to my platypus layout it keeps on crashing:

Traceback (most recent call last):
File
"/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response 77. response = callback(request, *callback_args,
**callback_kwargs) File
"/home/django/pointtec/../pointtec/catalog/views.py" in choice 60.
return render_presentation(selected_watches) File
"/home/django/pointtec/../pointtec/catalog/views.py" in
render_presentation 127. frame.addFromList(story, canvas) File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/platypus/frames.py"
in addFromList 217. if self.add(head,canv,trySplit=0): File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/platypus/frames.py"
in _add 157. flowable.drawOn(canv, self._x + self._leftExtraIndent, y,
_sW=aW-w) File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/platypus/flowables.py"
in drawOn 102. self._drawOn(canvas) File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/platypus/flowables.py"
in _drawOn 86. self.draw()#this is the bit you overload File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/platypus/flowables.py"
in draw 383. mask=self._mask, File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/pdfgen/canvas.py"
in drawImage 629. imgObj = pdfdoc.PDFImageXObject(name, image,
mask=mask) File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/pdfbase/pdfdoc.py"
in __init__ 1842. self.loadImageFromSRC(source) File
"/usr/local/lib/python2.5/site-packages/Reportlab-2.1-py2.5-linux-i686.egg/reportlab/pdfbase/pdfdoc.py"
in loadImageFromSRC 1891. fp = im.jpeg_fh()

AttributeError at /catalog/choice/
'unicode' object has no attribute 'jpeg_fh'

Any idea why this is happening? Ah, the image path is passed as unicode
object, but I'd be very surprised if that would be a problem.

I am using Python 2.5.1 with Reportlab 2.1.

Thanks in advance!

regards,
Marek


More information about the reportlab-users mailing list