Using Uno with Python

I would like to experiment with using Libreoffice from Python. I am running v7.1.3.2 on a Mac running v10.14.6. I installed uno but if I try to import it I get:

from base import Element, Css, Payload, UnoBaseFeature, UnoBaseField
ModuleNotFoundError: No module named ‘base’

Can someone please tell me where I’ve gone wrong or point me to a “how to”?

Hi
I know your question is pretty old but I get the same. Did you manage to make it work ?
Thanks a lot for your help
kind regards

Try https://python-ooo-dev-tools.readthedocs.io/

I never did get it to work. As luck would have it, I wanted to use this on a Mac and the documentation referred to above, is for Windows and Linux. .

@ihf I am the author of OooDev. OooDev is a python package so in theory it should work in a python environment on Mac as well.

OooDev has built in methods for detecting and starting LibreOffice automatically.
This is only important is you need to use that aspect of OooDev.
As if yet I have not been able to test on MAC. Althougth I have made attempts to ensure OooDev works on MAC.

If you want to use OooDev for macros then just include it as you would with any other pip install (pip install ooo-dev-tools.)

If you want to set up a project on MAC to run python scripts that automate LibreOffice, such as my Garlic Secrets example then I would suggest following the Linux setup of the Dev Docs for your virtual environment.

See Also the numerious Examples.

If you run into any specific MAC related issues setting up then please let me know and I will see what I can do.