[ERROR] pdfbuilder.py:130 cannot concatenate 'str' and 'int' objects

114 views
Skip to first unread message

João Patrício

unread,
Nov 6, 2013, 6:26:00 AM11/6/13
to rst2pdf...@googlegroups.com
Hey,

When running 

sphinx-build -bpdf sourcedir outdir

I'm running into this error:  [ERROR] pdfbuilder.py:130 cannot concatenate 'str' and 'int' objects

Here's the traceback.

Traceback (most recent call last):
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/pdfbuilder.py", line 127, in write
    docwriter.write(doctree, destination)
  File "/my/path/venv/local/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/pdfbuilder.py", line 621, in translate
    compressed=self.compressed)
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/createpdf.py", line 653, in createPdf
    pdfdoc.multiBuild(elements)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 972, in multiBuild
    self.build(tempStory, **buildKwds)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 892, in build
    self.handle_flowable(flowables)
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/createpdf.py", line 762, in handle_flowable
    if frame.add(f, canv, trySplit=self.allowSplitting):
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/flowables.py", line 559, in add
    return Frame.add(self, flowable, canv, trySplit)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/frames.py", line 174, in _add
    flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w)
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/flowables.py", line 248, in drawOn
    self.t.drawOn(canvas, x, y, _sW)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 109, in drawOn
    self._drawOn(canvas)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 90, in _drawOn
    self.draw()#this is the bit you overload
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/tables.py", line 1367, in draw
    self._drawCell(cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight))
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/tables.py", line 1475, in _drawCell
    v.drawOn(self.canv,x,y)
  File "/my/path/venv/local/lib/python2.7/site-packages/rst2pdf/image.py", line 488, in drawOn
    return self.image.drawOn(canv, x, y, _sW)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 109, in drawOn
    self._drawOn(canvas)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 90, in _drawOn
    self.draw()#this is the bit you overload
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 486, in draw
    mask=self._mask,
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 926, in drawImage
    imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2112, in __init__
    self.loadImageFromSRC(source)   #it is already a PIL Image
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2209, in loadImageFromSRC
    self._checkTransparency(im)
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2181, in _checkTransparency
    tc = im.getTransparent()
  File "/my/path/venv/local/lib/python2.7/site-packages/reportlab/lib/utils.py", line 668, in getTransparent
    return map(ord, palette[transparency:transparency+3])
TypeError: cannot concatenate 'str' and 'int' objects
FAILED

I'm clueless on could be going on. I think my conf.py file is in order.

Don't know if it's relevant, but I'm running it on a virtual environment. Any help would be greatly appreciated.

João

Michael Gielda

unread,
Nov 20, 2013, 9:03:40 AM11/20/13
to rst2pdf...@googlegroups.com
Hi,

What version of rst2pdf do you use? I remember running into this while using the apt-get version of rst2pdf in Debian (which is a stunning 0.16...). This version of rst2pdf did not support images with transparency, as far as I understand - using an image without transparency made the problem go away. So I uninstalled the apt-get version of rst2pdf, installed it with pip (0.93-dev) and then everything worked. Could you try this route assuming this is the case?

Cheers,
Michael
Reply all
Reply to author
Forward
0 new messages