Reputation: 24867
How do you make Python (any Python) know about PyUno in LibreOffice?
When I do:
import uno
python says that it knows no module "uno". (This question came up re. this question.)
Upvotes: 11
Views: 27131
Reputation: 1
import sys
sys.path.append("/usr/lib/python3/dist-packages")
sys.path.append("/usr/lib/libreoffice/program")
import uno
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
from com.sun.star.text import XTextContent
from com.sun.star.beans import PropertyValue
Upvotes: 0
Reputation: 420
For Debian, Ubuntu, and derivates:
sudo apt install libreoffice-script-provider-python
Upvotes: 6
Reputation: 13920
(UPDATING for 2014's)
Perhaps the most used UNO application is document conversion... For this task, in nowadays, you not need UNO, you can use directly
libreoffice --convert-to
About UNO itself, see the new home page, http://api.libreoffice.org/
A good example of using python3-uno
(or python-uno
) is the Docvert conversor (Docvert for py2).
Upvotes: 5
Reputation: 1
Try importing the libre office python extension.
yum install libreoffice-pyuno
Upvotes: -1
Reputation: 121
I am having the same issue with ubuntu 14.04 and python 2.7.6.
But if you are using ubuntu 12.04, try using sudo apt-get install python-uno.
Upvotes: 2
Reputation: 24867
Here's what I did:
inside the LibreOffice directory, there is a "program" directory with a python.exe, if I use that python (which is at version 2.6.1), I can import uno.
Upvotes: 0
Reputation: 9474
As said in the response to your comment there: it's an optional installable component for OpenOffice. See the Introduction to Python on OOo page in OpenOffice's Wiki for installation details
Upvotes: 2