Where is the bundled `python` executable in OpenOffice, in general?

As described in the Apache OpenOffice wiki, OpenOffice should be bundled with its own version of Python, which on Windows is located by default at C:\Program Files\OpenOffice.org <version>\program\python.exe.

Where is this Python executable located on other platforms? Where (if anywhere) is this location formally documented?


Where (if anywhere) is this location formally documented?

Nowhere as far as I know. Are you trying to do a system call at the specific location? It sounds risky because it might be in a slightly different place from what you expect. Maybe if you give more details about your goal then there would be a different way to accomplish it, such as environment variables.

The location on Windows is (AOO or LO Program Files directory)\program\python.exe.

Linux has system-wide versions of python so AOO and LO do not ship their own. However on those systems, an additional package may be required such as libreoffice-script-provider-python.

According to https://ask.libreoffice.org/t/where-is-the-python-executable-embedded-in-libreoffice-on-macos/50042/7, one user found it here on a Mac:

/Applications/LibreOffice.app/Contents/Resources/python

EDIT:

LO and AOO can be installed in different locations on your system, and both can be installed at the same time, so you need to specify which location to use.

To run Python for LibreOffice on Windows, I use the following batch script. It adds paths where libraries are located from my extension, which may not be needed in your case.

c:
@rem chdir "%ProgramFiles(x86)%\OpenOffice 4\program\"
@rem chdir "%ProgramFiles(x86)%\LibreOffice 5\program\"
chdir "%ProgramFiles%\LibreOffice\program\"

set ADD_ON=C:\MyExtensionPath
@rem "." is the current directory and is needed to import uno for AOO.
set PYTHONPATH=%ADD_ON%\pythonpath;%ADD_ON%\tests\pythonpath;.

python.exe %1

I also use a shell script for Ubuntu. It's much shorter because it uses the system wide python.

export PYTHONPATH=.:../pythonpath:./pythonpath
python3 $1

In either case, if the python script is planning to connect to LibreOffice (which is normally why you would run a script with UNO), then LibreOffice needs to be started listening on a socket.

start soffice -accept=socket,host=localhost,port=2002;urp; %1

Now if you are running the python script from within LibreOffice instead of externally, then none of this is necessary because LibreOffice already knows about its own version of python.