【问题标题】:unoconv not working on ubuntu 12.04 serverunoconv 无法在 ubuntu 12.04 服务器上运行
【发布时间】:2012-10-15 09:37:48
【问题描述】:

我正在使用unoconv 将不同的文件格式转换为 pdf。它在我的本地机器上运行良好,适用于所有格式。但是在我的 ubuntu 12.04 服务器上,unoconv 对于某些格式(例如 xls、ppt、pptx 等)失败了。但是它对于 doc 文件工作正常。 ppt转换显示如下错误。

$unoconv -f pdf Googling.ppt 
unoconv: UnoException during conversion in <class '__main__.com.sun.star.lang.IllegalArgumentException'>: Unsupported URL <file:///home/pythonuser/almamapper/media/library/files/c1cb92e62ce54b29a017a6e8eaa23c/Googling.ppt>: ""
Traceback (most recent call last):
File "/usr/bin/unoconv", line 790, in <module>
main()
File "/usr/bin/unoconv", line 769, in main
convertor.convert(inputfn)
File "/usr/bin/unoconv", line 679, in convert
error("ERROR: The provided document cannot be converted to the desired format. (code: %s)" % e.ErrCode)
File "/usr/lib/python2.7/dist-packages/uno.py", line 337, in _uno_struct__getattr__
return __builtin__.getattr(self.__dict__["value"],name)
AttributeError: ErrCode

我知道我必须在我的服务器上安装 openoffice-headless 版本。但是从link 我了解到 Ubuntu 不久前切换到 libreoffice 而不是 openoffice。于是我通过以下命令安装了 libreoffice。

apt-get install libreoffice-core libreoffice-writer libreoffice-calc

但仍然遇到同样的错误。我缺少要安装的东西吗?有人对这个问题有任何想法吗?

【问题讨论】:

    标签: shell ubuntu-12.04 libreoffice ubuntu-server


    【解决方案1】:

    我通过安装最新版本的unoconv 解决了上述问题。我尝试更新 libreoffice 并安装完整版本,但都没有帮助。

    我使用的是unoconv 0.3,最新的可用版本是 0.6。所以我安装了最新的,它解决了这个问题。

    这是我遵循的步骤:

    1. apt-get remove --purge unoconv(先把旧的unoconv去掉)
    2. git clone https://github.com/dagwieers/unoconv (从 gi​​thub 下载最新版本的 unoconv。)

    3. 现在 cd 到 unoconv 目录并执行 sudo make install

    注意:请执行 git clone,不要下载 tar 文件。在我的情况下,当我下载 tar 时安装失败。

    【讨论】:

    【解决方案2】:

    我在执行apt-get install unoconv 后遇到了同样的一般问题,另外一个apt-get install libreoffice 修复了它。可能您仅有限地安装了一些 libreoffice 组件是它仅适用于某些格式的原因。当然我希望它需要libreoffice-impress 进行 ppt 转换?

    【讨论】:

    • 我也试过了。最后我通过安装最新版本的unoconv 解决了这个问题。下面给出答案。感谢您的建议。
    • 我遇到了unoconv 的文档转换问题 (-f doc)。我确实可以在apt-get install libreoffice-writer 之后解决这个问题,谢谢@HermanHiddema。但我还需要杀死正在运行的 soffice 进程 killall soffice.bin 否则它不起作用。
    • @AndreMiras 尝试在 Ubuntu 桌面上运行时也是如此。我针对 12.04 桌面环境进行开发并针对 12.04 服务器进行部署。如果您在 LibreOffice 中打开了一个文档,并且您尝试在命令行中转换一个文档,则转换将静默失败。
    • @AndreMiras,感谢您通过提及 killall soffice.bin 来挽救这一天。我想知道为什么我没有得到结果。
    猜你喜欢
    • 2015-09-23
    • 1970-01-01
    • 2020-05-16
    • 1970-01-01
    • 2012-05-09
    • 2017-09-22
    • 2022-01-18
    • 1970-01-01
    • 2014-06-14
    相关资源
    最近更新 更多