Using OOoPython from an external script

Glenn Ramsey glenn.ramsey at slidespeech.com
Mon Apr 9 16:48:50 PDT 2012


Hi Christian, all,

On 09/04/12 11:28, Christian Lohmaier wrote:
> Hi Glenn, *,
>
> On Fri, Apr 6, 2012 at 10:32 PM, Glenn Ramsey
> <glenn.ramsey at slidespeech.com>  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?
>

If I was doing this for just me then I would use the LO Python, but for other 
users that could be a problem. I wouldn't call myself a naive user and it took 
me a little while to find out how to make it work. I want to write a module that 
will work when the user opens up a terminal and runs 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 LibreOffice.app - 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).
>
> See http://opengrok.libreoffice.org/xref/core/setup_native/scripts/osx_install_languagepack.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
> detour)
>

Thanks for that, I didn't know about mdfind. I think that might be a better way 
to do it than the way that unoconv does it. Just need to figure out how to drive 
it from Python.

Cheers
Glenn


More information about the LibreOffice mailing list