error in loop with for “python open document”

家住魔仙堡 提交于 2019-12-12 05:26:41

问题


I'm follow this tutorial appy.pod and I'm creating a list of dict more or less something like this:

params['reports'] = [{'date': foo.date, 'name': foo.name} for foo in something]

and in the libreoffice - writer i have a note with this

do text for foo in reports

and when I excecute the code I get this error

Syntax error while parsing a note whose content is "[]". In a note, you may specify at most 2 lines: a pod statement and a "from" clause. A Pod statement has the form: do {element} [{command} {expression}]. {element} identifies the part of the document that will be impacted by the command. It must be one of ('text', 'title', 'section', 'table', 'row', 'cell'). Optional {command} can be "if" (conditional inclusion of the element) or "for" (multiple inclusion of the element). For an "if" command, {expression} is any Python expression. For a "for" command, {expression} must be of the form: {name} in {expression}. {name} must be a Python variable name. It is the name of the iteration variable. {expression} is a Python expression that, when evaluated, produces a Python sequence (tuple, string, list, etc). A "from" clause has the form: from {expression}, where {expression} is a Python expression that, when evaluated, produces a valid chunk of odt content that will be inserted instead of the element that is the target of the note.

to make a note, is necessary active the 'track changes' mode?

there is another question related but that do not work for me Comments are seen as empty, even though they're not

somebody can help me, what I have wrong


回答1:


The solution is here appy forum

What pod version do you use? Note that, on Pypi, packages appy.pod and appy.shared are deprecated. Use new package appy. Gaetan

That I did was install pod with pip install and offcourse is deprecated, so you have to download the appy from here Download and copy the "appy" folder from appy.xxx.zip to the "site-packages" folder of your Python interpreter.



来源:https://stackoverflow.com/questions/15555589/error-in-loop-with-for-python-open-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!