2

I am trying to access a LibreOffice Writer document using Python. When I try to import uno I get: ModuleNotFoundError: No module named 'uno'

This occurs both when working in PyCharm as well as at the prompt when I launch "C:\Program Files\LibreOffice\program\python-core-3.8.10\bin\python.exe"

I have one version of Python installed: 3.8.10. I'm on Windows 11.

I do see uno.py here: "C:\Program Files\LibreOffice\program\uno.py"

I've added "C:\Program Files\LibreOffice\program" to my PATH environment variables and also tried making a junction between "C:\Program Files\LibreOffice\program" and "C:\Users[username]\AppData\Local\Programs\Python\Python38\Lib\uno"

I have spent several hours trying stuff here and elsewhere but to no avail. Any help would be wonderful!

1 Answers1

0

Pycharm uses venv virtuel environment. Even you include uno.py to path, it can't see it. Create a folder on your workdir. Then copy uno. in to. Then u can use from createdir import uno.

  • Thanks for the reply. I copied uno.py into my working directory and it did import, but then uno.py gave me this: ModuleNotFoundError: No module named 'pyuno'. I'm starting to think I'm not going to get this done: https://stackoverflow.com/questions/15223209/installing-pyuno-libreoffice-for-private-python-build/28593413#28593413 – Todd Mitchell Oct 15 '22 at 18:14
  • https://pypi.org/project/unotools/ also you can install uno lib manually. Download the lib. Then copy to workdir that too. Do you use venv ? – Capitan Security Oct 16 '22 at 06:43