Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenOffice.org development with pyUno for Windows—which Python?

At home, on Linux, I've experimented with pyUNO to control OpenOffice.org using Python. I've been using Python 2.6. It all seems to work nicely.

Now I thought I would try one of my scripts (run a graphical diff for ODF doc) on Windows. But when I tried to run it, I got:

ImportError: No module named uno

According to udk: Python UNO Bridge and OpenOffice.org Running Python on Windows, I have to run the Python interpretter that's installed with OpenOffice.org.

Q1: Is Python 2.6 available for OpenOffice.org?

However, that interpreter is Python 2.3, which is getting a little old! and my script uses a feature not supported by 2.3 (subprocess module).

Q2: Can pyUNO programming on Windows be done with a pyUNO add-on to the standard Python distribution, not the Python that is bundled with OpenOffice.org?

In my searching so far, I haven't been able to find any indication that there is a pyUNO module available to be installed into the standard Python Windows distribution... which is a surprise because on Ubuntu Linux, UNO is supported just fine in Python just by:

 apt-get install python-uno

Another problem with this is: what if I want to make a program that uses both pyUNO and other 3rd party libraries? I can't install pyUNO into my Python installation on Windows, so am I forced to somehow install my other 3rd party libraries into OpenOffice.org's bundled Python? It makes it difficult to create larger, more full-featured programs.

Am I missing something, or are we stuck with this situation for now?

like image 575
Craig McQueen Avatar asked Jun 15 '09 03:06

Craig McQueen


People also ask

What is Python uno?

Introduction. The Python-UNO bridge allows to. use the standard OpenOffice.org API from the well known python scripting language. to develop UNO components in python, thus python UNO components may be run within the OpenOffice.org process and can be called from Java, C++ or the built in StarBasic scripting language.

What is PyUNO?

What is PyUNO? LibreOffice allows the users to write macros in several interpreted languages, one of which is Python. PyUNO is the component that gives users access to the application programming interface (API hereinafter by its acronym Application Programming Interface) of LibreOffice with Python.


2 Answers

Per openoffice's docs, the Python version supported is WAY behind -- "Efforts on moving PyUNO to Python 2.5 continue", 2.6 not even on the map. So "stuck with this situation for now" is a fair assessment!-)

like image 173
Alex Martelli Avatar answered Sep 17 '22 13:09

Alex Martelli


OpenOffice.org 3.1 comes with Python 2.6.1. (As I recall, it was a fairly last-minute merge that ticked some people off, but it's there and it works.) Now the docs are the only thing hopelessly out-of-date. :)

like image 32
pantsgolem Avatar answered Sep 20 '22 13:09

pantsgolem