lehermj
lehermj

Reputation: 936

Error when importing OOSheet in python on Ubuntu

I am trying to edit Libreoffice-calc sheets through a python script using the library oosheet. I've followed their documentation and it seems to have installed correctly. But when I run "from oosheet import OOSheet as S" in the python shell, I returns this:

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

Upvotes: 1

Views: 674

Answers (1)

Jim K
Jim K

Reputation: 13819

On my Ubuntu system (14.04 Trusty, LO 4.2.8.2), LibreOffice uses python 3. So this works in a terminal:

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

But this fails:

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

The OOSheet web site does not say that it works on python 3, so you may need to switch to AOO, which still uses python 2. Or why not just use PyUNO directly instead of OOSheet.

Upvotes: 3

Related Questions