Python/UNO/OpenOffice?

John Machin sjmachin at lexicon.net
Sun Oct 1 03:21:17 CEST 2006


Sybren Stuvel wrote:
> kenneth.m.mcdonald at sbcglobal.net enlightened us with:
> > Are then any currently active and reasonably mature Python plugins/
> > apis/whatever for programming/scripting OpenOffice? The page I've
> > found is http://udk.openoffice.org/python/python-bridge.html, but it
> > was last updated more than a year ago.
>
> Aside from what has already been said, it might be nice for you to
> read my article about OOo and Python at
> http://www.stuvel.eu/ooo-python ;-)

Hi, Sybren. I tried folloing your recipe on Windows with OOo 2.0 ...

Minor problem: the executable is called soffice, not ooffice.

Major problem: it crashed right at the start, somewhere in the maze of
dlls.

The following interactive session reproduces the problem:

| C:\Program Files\OpenOffice.org
2.0\program\python-core-2.3.4\bin>python

# OOo includes a complete python distribution. Note the directory name
says 2.3.4 ...

| Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)]
on win32

... but the program identifies itself as 2.3.5

| Type "help", "copyright", "credits" or "license" for more
information.
| >>> import sys
| >>> sys.path.append(r'C:\Program Files\OpenOffice.org 2.0\program')

# The above directory contains all the dlls plus a handful of python
files

| >>> import pyuno # from pyuno.dll; there's no other pyuno.*
| >>> _g_ctx = pyuno.getComponentContext()

# crash

Has anyone managed to get further than this on Windows (XP Pro, SP 2)?

Cheers,
John




More information about the Python-list mailing list