在Ubuntu上导入python中的OOSheet时出错

2024-10-03 21:33:59 发布

您现在位置:Python中文网/ 问答频道 /正文

python正在尝试通过liboosc脚本编辑libooce表。我已经按照他们的文档进行了跟踪,并且似乎安装正确。但当我在python shell中运行“from 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

Tags: infromimport脚本com编辑linefile
1条回答
网友
1楼 · 发布于 2024-10-03 21:33:59

在我的Ubuntu系统(14.04trusty,lo4.2.8.2)上,LibreOffice使用python3。所以这在终端中有效:

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

但这失败了:

^{pr2}$

OOSheet网站没有说明它可以在python3上运行,因此您可能需要切换到AOO,它仍然使用python2。或者为什么不直接使用PyUNO而不是OOSheet呢。在

相关问题 更多 >