LibreOffice starts first as a ‘socket’ service The IDE connects to port #2017, sets a XSCRIPTCONTEXT substitute and run the script: – which creates a Writer doc and updates it LibreOffice remains active.
- In 2012, the original code for the 'Alternative Python Script Organizer' (APSO) was written by Hanya. Some adjustments to the code were made at that time by @karolus. In 2016, Hubert Lambert adapted the original script and made it into an.oxt extension.
- As a Python-based extension example, you might try APSO 1. Note that it might hand LibreOffice when tried to install first time. I had to kill soffice and re-run installation (without removing the incomplete installation) to successfully finish the installation.
- The Alternative Python Script Organizer (APSO) extension eases the edition of Python scripts, in particular when embedded in a document. Using APSO you can configure your preferred source code editor, start the integrated Python shell and debug Python scripts.
How do I install pip in Libreoffice's embedded Python on Linux? I wanted to install the pylint package for use in VS Code and display the syntax errors, but I need the pip first.
If I open Module.py in VS Code using system python, the VSCode Explorer Outline tab is blank and pylint doesn't work in libreoffice macros.
If I open Module.py in VS Code using libreoffice's built-in python the VSCode Explorer Outline tab displays all the variables and functions of my macro, but I can't install the pip.
NOTE: If I open Module.py in VS Code using libreoffice's built-in python and then switch to system python the VSCode Explorer Outline tab displays the variables and functions and pylint works too!
On Winsows 7 x64 I installed Libreoffice portable Version: 18.104.22.168 (x86) in the folder: C:PortableLibreOffice
Libreoffice's built-in python (v3.5.7) executable is: C:PortableLibreOfficeApplibreofficeprogrampython.exe
I followed this statement: https://pip.pypa.io/en/stable/install...
On Windows I was able to install the pip through get-pip.py script: https://bootstrap.pypa.io/get-pip.py
I copied the get-pip.py file to the directory: C:PortableLibreOfficeApplibreofficeprogram
and ran the following command from the prompt [cmd.exe]:C:PortableLibreOfficeApplibreofficeprogrampython.exe C:PortableLibreOfficeApplibreofficeprogramget-pip.py
ready he installed the pip and then installed pylint with this command:C:/Portable/LibreOffice/App/libreoffice/program/python.exe -m pip install -U pylint --user
My VS Code setup on Windows - 'settings.json':
I tried to use the same logic on Linux, but was unsuccessful:Linux Mint 19.3 x64 Cinnamon, Libreoffice Version: 22.214.171.124Note: I have the build-essential package installed: $ sudo apt-get install build-essential
It would be normal to install pip through this command on linux:$ sudo apt install python3-venv python3-pip
however it installs the pip in system python not Libreoffice's built-in python.
So I decided to do the same as in Windows:
Libreoffice's built-in python (v3.5.7) executable is: /opt/libreoffice6.3/program/python
I copied the get-pip.py file to the directory: /opt/libreoffice6.3/program/
and ran the following command on gnome-terminal:
$ sudo su
$ /opt/libreoffice6.3/program/python /opt/libreoffice6.3/program/get-pip.py
and it returns the following error:(more)
In 2012, the original code for the 'Alternative Python Script Organizer' ( APSO ) was written by Hanya.Some adjustments to the code were made at that time by @karolus.In 2016, Hubert Lambert adapted the original script and made it into an .oxt extension.The APSO extension is available on the French OpenOffice Forum, with an introduction text in French.
EDIT 2017-06-19 11:27As of today the APSO extension can also be downloaded from the LibreOffice Extensions repository:APSO - Alternative Script Organizer for Python ( Thanks Jean-Marc Zambon and @Ratslinger ).END OF EDIT 2017-06-19 11:27
EDIT 2017-12-21Added APSO menu screenshots with English menus [APSO_menu_en.png] and [APSO_dialogue_en.png], replacing the original screenshots that showed French menus [APSO_menu.png] and [APSO_dialogue.png].
i tried to translate the original introduction text from Hubert Lambert into English:( please forgive any errors in the translation that might have occurred, and correct where necessary.. )
______________ Start of translation
Managing Scripts in Pythonby Hubert Lambert » 09 Nov 2016 17:49
Good day to all,
[To follow up on [this thread](https://forum.openoffice.org/fr/forum/viewtopic.php?f=8&t=52689), and in particular the suggestion by Dude, i post here a part of the original message.]
Hanya, one of the most brilliant and effective contributors of the sections 'Macros and API' on the English-language forum, has in 2012 proposed a script ( Alternative Python Script Organizer ) that enormously simplifies the management of Python scripts on OpenOffice or LibreOffice. I think this script deserves a far better visibilty.
To make it easier to use, i have adapted it as follows :
Once this extension is installed ( and the program is restarted just to make sure ), a new menu-item 'Organize python scripts...' will appear in the submenu 'Macros' of the menu 'Tools'.
This new menu-item opens a dialog box listing the scripts and proposing various actions :
The button 'Execute' allows you to launch the selected macro.
The available actions from the button 'Menu' vary according to the selection, and they are :
This version 0.2, compatible with OpenOffice and LibreOffice, also includes the following elements :
Apso Libreoffice Update(more)
Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-02-10 13:42:43.050510
@librebel The version on the French site is the same - v0.8.3. It it definitely worth mentioning that APSO provides an easy mechanism to embed Python scripts into documents.
Merci @Ratslinger, i added that last line as a precaution in case a newer version might become available in the future, in case when this thread is not updated with the newest version, and the French site is.A propos... the APSO functionality should be integrated into LibreOffice.
Apso Libreoffice Free
Very useful. Using it now.
Apso Libreoffice Download
Is it expected that the extension (v.1.1.2) requires Java to run?