[reportlab-users] Re: broken code

NLH AS reportlab-users@reportlab.com
Tue, 09 Sep 2003 11:57:08 +0200


Re: reply from Robin Becker in reply to my posting (at foot):

++++
hi, we've not moved to 2.3 in any great weight yet so this could be of
use. Do you have a minimal example that gives this error? Can you run
with the same code and Python-2.2.3?
++++

Initial reaction: I don't think this can be a 2.3 problem -- the previous
box was running 2.3 also, so unless the previous installation managed to
access 2.2 in some weird way (that machine had both, the new server has
only 2.3) this is more probably a case of the code running with Reportlab
approx. 1.16 with Python 2.3, but not with RL 1.18. 

I'll try to run some tests to whether this is in some way data-specific
(doesn't look like it) and fiddle with various versions, but this may take
a little time (urgent though it is).

Rgds

Paul Mothersdill



=================== Original posting:

>Message: 2
>From: post@nlhas.no
>Cc: 
>To: reportlab-users@reportlab.com
>Date: Mon,  8 Sep 2003 20:41:31 +0200 (MEST)
>Subject: [reportlab-users] Broken code
>Reply-To: reportlab-users@reportlab.com
>
>Is anybody able to help with this one? Attempting to run code that has run =
>perfectly for over a year on our previous box (probably with a previous ver=
>sion of Reportlab), fails on a fresh install with the latest version (downl=
>oaded in the course of a long weekend rebuilding the server...!).
>
>Traceback (see foot for full version):
>
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 1839, in format
>    dict["Filter"] =3D PDFArray(map(PDFName,self._filters))
>AttributeError: PDFImageXObject instance has no attribute '_filters'
>
>Any help would be most appreciated.
>
>Rgds
>
>Paul Mothersdill
>
>
>
>The document is a SimpleDocTemplate with a header and flowed body text -- i=
>n simplified form:
>
>
>    doc =3D SimpleDocTemplate(_filename)
>    doc.rightMargin =3D 40
>    doc.showBoundary =3D 0
>    doc.leftMargin =3D 40
>    doc.topMargin =3D 40
>    doc.bottomMargin =3D 40   =
>
>    data=3D  [[B , A]] # predefined lists of objects, including a gif logo =
>& text
>    t=3DTable(data, colWidths=3D(330,175) ,
>            style=3D[('VALIGN' ,(0,0),(-1,-1) , 'TOP'),
>            ('LINEBELOW',(0,-1),(-1,-1),2,colors.black)])
>    # stuff to flow in the body text (approx 20 lines).
>    doc.build(docflow, onFirstPage=3DmakePage, onLaterPages=3DmakePage)
>
>
>def makePage(canvas, doc):
>    canvas.saveState()
>    canvas.setFont('Courier-Bold',16)
>    canvas.restoreState()
>  =
>
>
>Full traceback:
>
>  File "/home/public/nlh/nlhapp/utils/message/makefax.py", line 123, in mak=
>efax
>    doc.build(docflow, onFirstPage=3DmakePage, onLaterPages=3DmakePage)
>  File "/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctempla=
>te.py", line 765, in build
>    BaseDocTemplate.build(self,flowables)
>  File "/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctempla=
>te.py", line 611, in build
>    self._endBuild()
>  File "/usr/local/lib/python2.3/site-packages/reportlab/platypus/doctempla=
>te.py", line 585, in _endBuild
>    if getattr(self,'_doSave',1): self.canv.save()
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfgen/canvas.py",=
> line 818, in save
>    self._doc.SaveToFile(self._filename, self)
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 230, in SaveToFile
>    f.write(self.GetPDFData(canvas))
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 250, in GetPDFData
>    return self.format()
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 373, in format
>    IOf =3D IO.format(self)
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 722, in format
>    fcontent =3D format(content, document, toplevel=3D1) # yes this is at t=
>op level
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 96, in format
>    f =3D fmt(document)
>  File "/usr/local/lib/python2.3/site-packages/reportlab/pdfbase/pdfdoc.py"=
>, line 1839, in format
>    dict["Filter"] =3D PDFArray(map(PDFName,self._filters))
>AttributeError: PDFImageXObject instance has no attribute '_filters'
>
>hi, we've not moved to 2.3 in any great weight yet so this could be of
>use. Do you have a minimal example that gives this error? Can you run
>with the same code and Python-2.2.3?