【问题标题】:Python-uno not working in ubuntu 14.04Python-uno 在 ubuntu 14.04 中不起作用
【发布时间】:2016-04-18 10:45:57
【问题描述】:

我有一个使用 python 2.7 在 Ubuntu 12.04 中开发的 python 项目。它正在使用使用

安装的 pyoo 和 uno

pip install pyoo

apt-get -y install python-uno

在 ubuntu 到 14.04 上使用这个项目时。

a) 在安装 apt-get install python-uno 时它说 包python-uno不可用,但被另一个引用
包裹。这可能意味着包丢失,已经过时,
或仅可从其他来源获得 但是,以下软件包替换了它: libreoffice-script-provider-python 所以我已经安装了apt-get install libreoffice-script-provider-python

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'
`

我应该怎么做才能使用 python 2.7 在 ubuntu 14.04 上正确运行它?

【问题讨论】:

  • 做一个 apt-cache 搜索,它可能会抛出一些东西
  • 请详细说明它与我的查询有何关系...!!

标签: python python-2.7 ubuntu libreoffice uno


【解决方案1】:

在较新的 Ubuntu 系统上,请始终记住在使用 Python-UNO bridge 时使用 Python 3。这些命令在我的系统上运行:

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

顺便说一句,即使没有pyoo,只要安装了libreoffice-script-provider-python,这应该可以工作:

$ python3
>>> import uno
>>> uno.getConstantByName('com.sun.star.i18n.NumberFormatIndex.TEXT')
49

【讨论】:

    猜你喜欢
    • 2016-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 2015-11-10
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多