python-docx-template的Jinja报错'builtin_function_or_method' object is not iterable

 

报错如下

File "C:\Python27\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "C:\Python27\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 1, in top-level template code
TypeError: 'builtin_function_or_method' object is not iterable

 

排查,模板引用中使用了关键字 values等

 

{%tc for col in report.threat_score.weeks %}

{{col}}

{%tc endfor %}

{%tc for col in report.threat_score.values %}

{{col}}

{%tc endfor %}

{%tc for col in report.threat_score.values %}

posted @ 2018-11-13 09:51  inns  阅读(6006)  评论(0编辑  收藏  举报