在Ubuntu

时间:2016-02-04 16:23:04

标签: python ubuntu libreoffice

我正在尝试使用库oosheet通过python脚本编辑Libreoffice-calc表。我已经按照他们的文档,它似乎已正确安装。但是当我在python shell中运行“从oosheet import OOSheet as S”时,我会返回:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/herm/.local/lib/python2.7/site-packages/oosheet/__init__.py", line 30, in <module>
from com.sun.star.awt import WindowDescriptor
ImportError: No module named com.sun.star.awt

1 个答案:

答案 0 :(得分:3)

在我的Ubuntu系统(14.04 Trusty,LO 4.2.8.2)上,LibreOffice使用python 3.所以这适用于终端:

python3
>>> import uno
>>> from com.sun.star.awt import WindowDescriptor

但这失败了:

python
>>> import uno
ImportError: No module named uno

OOSheet网站并没有说它在python 3上有效,所以你可能需要切换到仍然使用python 2的AOO。或者为什么不直接使用PyUNO而不是OOSheet。