Distrotech / reportlab

Mirror of https://bitbucket.org/rptlab/reportlab
Other
61 stars 41 forks source link

ZeroDivisionError in normalizeData #2

Open spektom opened 8 years ago

spektom commented 8 years ago

I'm getting the following exception:

  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 799, in handle_flowable
    if frame.add(f, canv, trySplit=self.allowSplitting):
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/platypus/frames.py", line 196, in _add
    flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 112, in drawOn
    self._drawOn(canvas)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/platypus/flowables.py", line 93, in _drawOn
    self.draw()#this is the bit you overload
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/shapes.py", line 682, in draw
    renderPDF.draw(self, self.canv, 0, 0, showBoundary=showBoundary)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderPDF.py", line 29, in draw
    R.draw(renderScaledDrawing(drawing), canvas, x, y, showBoundary=showBoundary)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderbase.py", line 199, in draw
    self.drawNode(drawing)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderPDF.py", line 55, in drawNode
    self.drawNodeDispatcher(node)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderbase.py", line 280, in drawNodeDispatcher
    self.drawGroup(node)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderbase.py", line 297, in drawGroup
    node = _expandUserNode(node,canvas)
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/renderbase.py", line 161, in _expandUserNode
    node = node.provideNode()
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/widgetbase.py", line 150, in provideNode
    return self.draw()
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/charts/piecharts.py", line 910, in draw
    w = self.makeWedges()
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/charts/piecharts.py", line 718, in makeWedges
    angles = self.makeAngles()
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/charts/piecharts.py", line 684, in makeAngles
    D = [a for a in enumerate(self.normalizeData(keepData=wr))]
  File "/home/spektom/.virtualenvs/dw/local/lib/python2.7/site-packages/reportlab/graphics/charts/piecharts.py", line 670, in normalizeData
    f = 360./s
ZeroDivisionError: float division by zero

I guess this piece of code from normalizeData() is problematic:

if s<=1e-8: s = 0
f = 360./s