Re: UnboundLocalError inside platypus api
Tim Roberts <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
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.__dict__.update(self.defaults) > > self.name <http://self.name>="Title" > self.fontName='Times-Bold' > self.alignment='LEFT' "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, [email protected] Providenza & Boekelheide, Inc. _______________________________________________ reportlab-users mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/reportlab-users