Using OOoPython from an external script

Christian Lohmaier lohmaier+libreoffice at
Sun Apr 8 16:28:35 PDT 2012

Hi Glenn, *,

On Fri, Apr 6, 2012 at 10:32 PM, Glenn Ramsey
<glenn.ramsey at> wrote:
> [...]
> In order for a system python script to be able to execute lo-python it needs
> to know where LO is installed and what platform it is running on.

But why do you want to run system python when LO on Mac comes with its
own python?

It is much easier to just call your script with the python
wrapper-script that sets the environment variables and uses LO's
python than to hook up to a different python from the system's python.

> I hacked
> up code that does this on Windows by looking in the registry for
> soffice.exe, but before I start implementing it for other platforms I
> thought I should check that I'm not reinventing the wheel. Does anyone know
> of some code that already does this? It doesn't have to be in Python.

I'd try to just look in /Applications for the - and
failing that, try to use mdfind - if that also fails, give up and ask
the user to manually specify the installation path/show a filepicker.

Using mdfind and fallick back to asking the user is what the Language
pack installer does (via applescript).


(in the actual languagepack installer It is packaged as a
shell-executable-bundle that uses osascript to run the script, as
"applescript-apps" cannot do any UI interaction, thus this little


More information about the LibreOffice mailing list