0

I have a python project developed in Ubuntu 12.04 using python 2.7 . It is using pyoo and uno installed using

pip install pyoo

apt-get -y install python-uno

While using this project on ubuntu to 14.04 .

a) while installing apt-get install python-uno it says Package python-uno is not available, but is referred to by another
package. This may mean that the package is missing, has been obsoleted,
or is only available from another source However the following packages replace it: libreoffice-script-provider-python So i have installed apt-get install libreoffice-script-provider-python

b) On ubuntu 14.14 it shows following error

`Traceback (most recent call last):
  File "/data/mdm/rawtoreportv5/ditupload.py", line 3, in <module>
    from ditmgmt.ditmt import *
  File "/data/mdm/rawtoreportv5/ditmgmt/ditmt.py", line 1, in <module>
    import pyoo
  File "/usr/local/lib/python2.7/dist-packages/pyoo.py", line 26, in <module>
    FORMAT_TEXT = uno.getConstantByName('com.sun.star.i18n.NumberFormatIndex.TEXT')
AttributeError: 'module' object has no attribute 'getConstantByName'
`

What should i do to run it properly on ubuntu 14.04 with python 2.7?

Varun Chawla
  • 303
  • 1
  • 6
  • 19

1 Answers1

-1

On newer Ubuntu systems, always remember to use Python 3 when using the Python-UNO bridge. These commands worked on my system:

$ sudo apt-get install python-pip
$ sudo pip3 install pyoo
$ python3
>>> import pyoo

By the way, even without pyoo, this should work as long as libreoffice-script-provider-python is installed:

$ python3
>>> import uno
>>> uno.getConstantByName('com.sun.star.i18n.NumberFormatIndex.TEXT')
49
Jim K
  • 12,824
  • 2
  • 22
  • 51