# Python macros on LibreOffice on OS X

My setup is LibreOffice 5.1.1.3 running under OS X 10.11.4. When I open Tools/Macros/Organize Macros/python..., Create and Edit are ghosted. However if I go to LibreOffice Macros/HelloWorldPython, "Run" gets unghosted and if I click on it, the macro seems to run and a new Text Document appears with the words "Hello World (in Python)".

So python seems to be installed and working, but I can't create or edit any python macros. I then used Spotlight to search my entire harddrive for any .py files that might be associated with LibreOffice but couldn't find anything.

Searching the web there are some potential solutions that include a lot of command line adding of packages, etc., but I don't want to do that until I've exhausted the simple solutions (since python for LibreOffice already seems to be installed and working, and LibreOffice clearly knows it's there).

Any ideas about what's going on?

4/30 Update:

Back to OS X after a month of successful macro development in Windows and linux. Per karolus's suggestion, I tried putting my macro in ~/.config/libreoffice/4/user/Scripts/python/. That's what works for Ubuntu 16.04 (and a similar directory for Win 10), but macros placed there don't appear in as calc macros under OS X.

So I thought I'd try putting my macro where I know calc does find macros.
find /Applications/ -name 'HelloWorld.py' returns
/Applications//LibreOffice Vanilla.app/Contents/Resources/Scripts/python/HelloWorld.py, but
ls -l /Applications//LibreOffice Vanilla.app/Contents/Resources/Scripts/python/
tells me "No such file or directory".

I think there's some sort of weird outside-standard-*nix file structure going on. In any case this is clearly not the correct path for user macros.

So still stuck. Like this guy from over a year ago.

edit retag close merge delete

Not familiar with Mac, but I think I see your problem:

ls -l /Applications//LibreOffice Vanilla.app/Contents/Resources/Scripts/python/


The space between "LibreOffice" and "Vanilla.app" is splitting the argument in two. Put quotes around it and I think it will work. And I think you're wright about that being the place to put macros (though I can't confirm it).

( 2017-01-25 09:55:11 +0200 )edit

This does appear to be the problem. An alternative to quotes is to use unix \ immediately before the space:

ls -l /Applications//LibreOffice\ Vanilla.app/Contents/Resources/Scripts/python/

( 2017-06-07 12:46:39 +0200 )edit

Sort by » oldest newest most voted

Hallo

There is no Integrated Development Editor ( IDE ) for python inside LO … you have to manage that Stuff by yourself.

more

That's fine, I've already written the script. But how do I get the script to appear as a usable macro in the Macro section of LO? In other words, how do I use the python functionality that obviously exists, but at this point appears to be limited to "Hello World" and a few other scripts that come with LO installation?

( 2016-04-04 14:15:48 +0200 )edit

Store your Scripts into path: ~<your_Lo_config_folder>/Scripts/python/…

( 2016-04-04 19:33:21 +0200 )edit

See update to original question

( 2016-04-30 17:28:55 +0200 )edit