[英]Python-uno not working in ubuntu 14.04
I have a python project developed in Ubuntu 12.04 using python 2.7 . 我有一个使用python 2.7在Ubuntu 12.04中开发的python项目。 It is using pyoo and uno installed using
它正在使用pyoo和uno安装使用
pip install pyoo
apt-get -y install python-uno
While using this project on ubuntu to 14.04 . 在Ubuntu 14.04上使用此项目时。
a) while installing apt-get install python-uno
it says Package python-uno is not available, but is referred to by another a)在安装
apt-get install python-uno
它说软件包python-uno不可用,但是被另一个引用
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
或仅可从其他来源获得,但是以下软件包将其替换:
libreoffice-script-provider-python
所以我已经安装了apt-get install libreoffice-script-provider-python
b) On ubuntu 14.14 it shows following error b)在Ubuntu 14.14上显示以下错误
`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? 我应该怎么做才能在python 2.7的ubuntu 14.04上正常运行?
On newer Ubuntu systems, always remember to use Python 3 when using the Python-UNO bridge . 在较新的Ubuntu系统上,始终记得在使用Python-UNO bridge时使用Python 3。 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: 顺便说一句,即使没有
pyoo
,只要安装了libreoffice-script-provider-python
,这也应该起作用:
$ python3
>>> import uno
>>> uno.getConstantByName('com.sun.star.i18n.NumberFormatIndex.TEXT')
49
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.