Question

I am new to linux and was wondering how I go about getting the uno python module from openoffice to work within a python script.

I have attempted to uninstall and reinstall open office on my machine. Change the PYTHONPATH variables and nothing appears to be working.

Would someone be willing to give an in depth guide on the step taken to get this to work on a fedora linux machine.

My python script is as follows.

import uno

print ("Create Document Script")

The following error is returned when the script is run

Traceback (most recent call last):
  File "pyCreateDocumentScript.py", line 1, in <module>
    import uno
ImportError: No module named uno

Help is greatly appreciated. Thanks in advance

Was it helpful?

Solution

If you successfully installed python3-uno, I suspect that you were not running your script with python3 but a previous version of python.
To run python scripts with uno for libreoffice you must run your scripts with python3

OTHER TIPS

Python should import uno module so you should import it form openoffice.org package by typing the following command

/opt/openoffice4/program/python scriptname.py

Then the uno module is imported from openoffice.org(if you dont specify the path it will take the default python without uno module)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top