报告实验室 - 提高ValueError(' paraparser:语法错误:%s'%消息)ValueError:(u" paraparser:语法错误:无效的属性名称alt attrMap

时间:2017-08-23 21:56:37

标签: python reportlab

使用Reportlab生成pdf,一切顺利。遇到引发以下错误的问题......

raise ValueError('paraparser: syntax error: %s' % message)
ValueError: (u"paraparser: syntax error: invalid attribute name alt attrMap=['height', 'src', 'valign', 'width']", '\nparagraph text u\'<para><p><strong>

这似乎是由一个ReportLab不喜欢的角色引起的,因为我可以使用&#34; escape&#34;但这会导致段落忽略<P><strong>

等格式

是否有快速识别相关角色的方法?或者也许是解决这个问题的另一种方法?

def getDescription(eventid):

    res = tq.get("api/events/%s/" % eventid)
    ed = res['data']['description']

    if not ed:
        logger.debug("No description exists for event %s. Skipping this section." % eventid)
        return()
    else:   
        formattedDesc = ed.replace('\n', '<br/>')
        logger.debug("Description of event is \n %s" % formattedDesc)
        #Story.append(Paragraph(escape(formattedDesc), styles["TQ-Description"]))
        #Changed to the following to prevent an error thrown by XX reports. Need to figure out why.
        Story.append(Paragraph(escape(formattedDesc), styles["TQ-Description"]))

0 个答案:

没有答案