Page 1 of 1

Build LibreOffice Uno libraries for python3

Posted: Mon Apr 27, 2020 8:17 am
by nancy2510
I want to use uno libraries to disable some of the menu options in Libreoffice document.

Os Using:
> uname -a
> Linux #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 x86_64 x
86_64 GNU/Linux Red Hat 4.8.5-39
Python version : Python 3.6.8
libreoffice version - LibreOffice 5.3.6.1 30(Build:1)
I am not able to do "import uno" or "import pyuno" in python 3. However both commands are working properly in Python2

Error I am getting in python 3:

Code: Select all

    >>> import pyuno
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: dynamic module does not define module export function (PyInit_pyuno)
    >>> import uno
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'uno'
Some of the more research which I have done

Code: Select all

    (/usr/lib64/libreoffice/program)-1037> objdump -t -T -r -R pyuno.so | grep initpyuno
    0000000000000a90 g    DF .text  0000000000000117  Base        initpyuno
I think my libreoffice is built against Python 2.x . But I wasnt able to find any solution how to build it against python3.x Thanks in advance.

Re: Build LibreOffice Uno libraries for python3

Posted: Mon Apr 27, 2020 10:29 am
by robleyd
Also posted at https://stackoverflow.com/questions/614 ... or-python3

As suggested there, please include the particular flavour of Linux that you are using.

Re: Build LibreOffice Uno libraries for python3

Posted: Mon Apr 27, 2020 10:33 am
by nancy2510
@robleyd: Done

Re: Build LibreOffice Uno libraries for python3

Posted: Mon Apr 27, 2020 10:40 am
by RoryOF
As you are using LibreOffice, you may get some LibreOffice specific information from very experienced users by putting your question on
https://ask.libreoffice.org/en/questions/

Please give there links to this and the stackoverflow discussions.

Re: Build LibreOffice Uno libraries for python3

Posted: Mon Apr 27, 2020 10:43 am
by robleyd
I hoped that you would advise here, to save people having to go to Stackoverflow; I note that on that site you have apparently given the kernel version you are using, rather than the particular distribution and version - e.g. Ubuntu 23.6 or ArchLinux 42 or Debian Shrink.

Yes, I know the above are made up versions.