[reportlab-users] UnboundLocalError inside platypus api
timr at probo.com
Thu Nov 29 13:02:05 EST 2018
Mike Hostetler wrote:
> 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.name <http://self.name>="Title"
"alignment" is not a string value, it's an enumeration. You need to use:
from reportlab.lib.enums import *
self.alignment = TA_LEFT
One might argue that the library should have presented a more meaningful
error message in this case, by supplying a default value for dpl and
checking that the default managed to sneak through.
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users