[reportlab-users] UnboundLocalError inside platypus api
Mike Hostetler
mike at squarepegsystems.com
Thu Nov 29 10:29:27 EST 2018
Using Platypus, I got this interesting error:
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/django/core/handlers/exception.py"
in inner
34. response = get_response(request)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
126. response = self.process_exception_by_middleware(e,
request)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
124. response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/django/contrib/auth/decorators.py"
in _wrapped_view
21. return view_func(request, *args, **kwargs)
File "/Users/mikeh/Projects/myproject/waterbooks/reporting/views.py" in
fto_for_project
12. buf = generate_fto_project()
File "/Users/mikeh/Projects/myproject/waterbooks/reporting/services.py" in
generate_fto_project
86. doc.build(doc_elements)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/doctemplate.py"
in build
1271. BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/doctemplate.py"
in build
1036. self.handle_flowable(flowables)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/doctemplate.py"
in handle_flowable
892. if frame.add(f, canv, trySplit=self.allowSplitting):
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/frames.py"
in _add
196. flowable.drawOn(canv, self._x + self._leftExtraIndent,
y, _sW=aW-w)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/flowables.py"
in drawOn
113. self._drawOn(canvas)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/flowables.py"
in _drawOn
94. self.draw()#this is the bit you overload
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/paragraph.py"
in draw
1720. self.drawPara(self.debug)
File
"/Users/mikeh/.pyenv/versions/myproject/lib/python3.6/site-packages/reportlab/platypus/paragraph.py"
in drawPara
2190. t_off = dpl( tx, offset, ws, words, lastLine)
Exception Type: UnboundLocalError at /reports/
Exception Value: local variable 'dpl' referenced before assignment
Note that this is inside the Platypus API
It happens when it's trying to apply this custom style. If I use
style['Normal'], it works fine:
class TitleStyle(ParagraphStyle):
def __init__(self):
self.__dict__.update(self.defaults)
self.name="Title"
self.fontName='Times-Bold'
self.alignment='LEFT'
self.fontSize=21
self.leading=24
self.leftIndent=0.75*inch
--
Mike Hostetler
SquarePeg Systems
http://www.squarepegsystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20181129/8a63b88d/attachment.html>
More information about the reportlab-users
mailing list