[reportlab-users] Problem on Mac OSX

Andy Robinson andy at reportlab.com
Mon Oct 1 15:44:13 EDT 2007


I think this is a problem with the specific copy of the Python Imaging
Library you have installed on your Mac OS. On many platforms, PIL is
compiled with jpeg support. It seems your PIL isn't. We also had
this from a customer on Mac OS last week.

Can anyone who knows Mac OS well recommend what versions of PIL to
install, or what options are needed to recompile it with JPEG support?

On your second question, we don't normally run scripts from within an
interactive prompt.
If you want to, you need to run the same code which is at the bottom
of that script e.g.


>>> import os

>>> os.chdir('c:\\code\\reportlab\\test')

>>> import unittest

>>> import test_pdfgen_general

>>> unittest.TextTestRunner().run(test_pdfgen_general.makeSuite())

.
----------------------------------------------------------------------
Ran 1 test in 1.011s


- Andy



On 01/10/2007, Y Tu <ytu888 at hotmail.com> wrote:

>

> I installed PIL and ReportLab on Mac OS X. The test-run with command "from

> PIL import Image" followed by "import _imaging", and "from

> reportlab.graphics import renderPDF" succeeded. However, when I run the test

> script (eportlab/test/test_pdfgen_general.py) coming with

> the package, I got the following error. How to fix the problem. Another

> question is how to run the script under the python prompt (>>>) after

> importing the scirpt by "import test_pdfgen_general.py". Thank yuo very

> much.

>

>

> nypivs-lee:/Applications/MacPython 2.5/reportlab/test lee$

> python test_pdfgen_general.py

> E

> ======================================================================

> ERROR: Make a PDFgen document with most graphics features

> ----------------------------------------------------------------------

> Traceback (most recent call last):

> File "test_pdfgen_general.py", line 833, in test0

> run(outputfile('test_pdfgen_general.pdf'))

> File "test_pdfgen_general.py", line 796, in run

> c = makeDocument(filename)

> File "test_pdfgen_general.py", line 725, in makeDocument

> c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto')

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/reportlab/pdfgen/canvas.py",

> line 629, in drawImage

> imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/reportlab/pdfbase/pdfdoc.py",

> line 1840, in __init__

> self.loadImageFromA85(src)

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/reportlab/pdfbase/pdfdoc.py",

> line 1846, in loadImageFromA85

> imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG))

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/reportlab/pdfbase/pdfutils.py",

> line 35, in makeA85Image

> raw = img.getRGBData()

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/reportlab/lib/utils.py",

> line 612, in getRGBData

> self._data = im.tostring()

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.py",

> line 513, in tostring

> self.load()

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/ImageFile.py",

> line 180, in load

> d = Image._getdecoder(self.mode, d, a, self.decoderconfig)

> File

> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.py",

> line 375, in _getdecoder

> raise IOError("decoder %s not available" % decoder_name)

> IOError: decoder jpeg not available

>

> ----------------------------------------------------------------------

> Ran 1 test in 0.321s

>

> FAILED (errors=1)

>

> ________________________________

> Invite your mail contacts to join your friends list with Windows Live

> Spaces. It's easy! Try it!

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

>



--
Andy Robinson
CEO/Chief Architect
ReportLab Europe Ltd.
165 The Broadway, Wimbledon, London SW19 1NE, UK
Tel +44-20-8544-8049


More information about the reportlab-users mailing list