【问题标题】:error in loop with for "python open document"“python打开文档”循环错误
【发布时间】:2013-03-21 18:41:23
【问题描述】:

我正在关注本教程appy.pod,我正在创建一个或多或少类似这样的 dict 列表:

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

在 libreoffice - 作者我有一个注释

do text for foo in reports

当我执行代码时出现此错误

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.

要记笔记,是否需要激活“跟踪更改”模式?

还有另一个相关的问题,但对我不起作用 Comments are seen as empty, even though they're not

有人可以帮助我,我有什么问题

【问题讨论】:

  • 这是一个实际的错误信息?哇。
  • @NPE 是的,可以在 libreoffice Writer 中已经生成的报告中看到
  • 那是惊讶而不是怀疑的表达:)
  • 对我来说 pod 运行得非常好。制作报告很容易,您可以使用 libreoffice 或 OO 作为所见即所得的报告编辑器。无需激活“跟踪更改”模式即可在评论中编写 pod 代码。让 OO 文档和源代码可供审查。
  • 另外,不要从 pip 或 easy_install 安装 pod。下载项目并将其手动包含在您的解决方案中。

标签: python libreoffice


【解决方案1】:

解决方案在这里appy forum

您使用的是哪个 pod 版本? 请注意,在 Pypi 上,包 appy.pod 和 appy.shared 已被弃用。使用新的应用程序包。 盖坦

我所做的是使用 pip install 安装 pod,并且不推荐使用 offcourse,因此您必须从这里下载 appy Download 并将“appy”文件夹从 appy.xxx.zip 复制到“site-packages”文件夹你的 Python 解释器。

【讨论】:

  • 手动安装是不必要的,因为主要开发人员建议您只需从 pip 安装“appy”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-02-18
  • 1970-01-01
  • 1970-01-01
  • 2018-06-28
  • 2015-08-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多