[reportlab-users] Broken code

reportlab-users@reportlab.com reportlab-users@reportlab.com
Mon, 8 Sep 2003 22:48:42 +0200 (MEST)


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'