Ask Your Question

Python macros on LibreOffice on OS X [closed]

asked 2016-04-03 23:05:22 +0200

yonkiman gravatar image

updated 2020-07-13 15:00:47 +0200

Alex Kemp gravatar image

My setup is LibreOffice 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 '' returns
/Applications//LibreOffice, but
ls -l /Applications//LibreOffice
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 flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-07-13 15:01:15.148164


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

ls -l /Applications//LibreOffice

The space between "LibreOffice" and "" 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).

Nateowami gravatar imageNateowami ( 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\
avei gravatar imageavei ( 2017-06-07 12:46:39 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-04-04 13:19:19 +0200

karolus gravatar image


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

edit flag offensive delete link 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?

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

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

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

See update to original question

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

Question Tools

1 follower


Asked: 2016-04-03 23:05:22 +0200

Seen: 1,627 times

Last updated: Apr 30 '16