About Python with LibreOffice

Hello LibreOffice World

I suppose that Python was installed (during installation of LibreOffice) on the target
C:\Program Files\LibreOffice\program\python-core-3.9.21.

Python.exe in the \bin folder starts when I double-click the icon.
Now, when in LibreOffice I change to Tools > Macros > Macro management and select Python there are nothing to select,everything is grayed out.

I have to add that I hate Python, but it seems to give the widest possibilities for manipulating LibreOffice with macros. However, I’d like to test whether the relationship can turn into a love-hate relationship.

IMHO the API is the same, if you use BASIC, Python or JavaScript.
.
In the old days you could write macros in Python, but you would need to do everything yourself like placing macros in the right folders. Today there is APSO to help with this for Python:

Please note: The python delivered with LibreOffice is not “complete”. Some modules/libraries are missing and there is no pip (see below) to install more. Exeptions are Linux-distributions where LibreOffice usually uses the python-interpreter, wich is already installed with the OS.

Edit: Wiki-Link added:
https://wiki.documentfoundation.org/Macros/Python_Design_Guide

Edit2:
On pip see below:

I wonder about people who pretend to “hate” something although they obviously know next to nothing about this “something”, not to mention that they can’t even give valid reasons for this hatred!
Yes @ $(my special friend) you can feel addressed too!

The reason I started to hate it was: when I installed the IronPython package in VisualStudio and tested it, I built a simple Web SOAP based tuning. Then when I examined the output, I found that Python had accumulated over 1/2 GB of useless crap on my hard drive.

I would first assume VisualStudio was responsible for this, not python!

Why didn’t the same thing happen when I coded the same tuning with C# and build the app?

The Python runtime shipped with LibreOffice 28.2 takes 24MB on Linux. I write macros and extensions with a plain text editor and MRI.
$ du -hs python-core-3.10.16/
24M python-core-3.10.16/

That may be the case, but I didn’t mean how much disk space the Python installation requires, but how much crap appeared on my hard drive when Python compiled my tuning into an app. The same did not happen when I coded and built the same tuning using C#.

Youre the one who should know whats going on, ( I’ll never need to »compile a app« )

Well, it was my first experience with Python and I wasn’t particularly impressed.

Do you mean I am not aware that when a script is executed it is not compiled into an application but executed at runtime…?

tdf#162786

Does this work? Download the https://bootstrap.pypa.io/get-pip.py

Imho no - it wasn’t so easy. But I didn’t try.
Check the thread linked by @mikekaganski After the patch you can obviously run ensure-pip.
There are currently extensions like Zazip (?) and also an apso-variant with pip in use. Just search a bit.

When I wish to have a full python I use “my own” installed python. This can “talk” to LibreOffice via a port, like the Jupyter-notebooks suggested by by @karolus . (But because I’m used to it I usually write programs, wich modify files. The files may be loaded (or produced) by LibreOffice… )
.
And for the macros I use/wrote language is often no issue.

Thank you for your reply.

the pip-»switch« is meanwhile available in the master-branch, just hit the Options-button in Extension-dialog!

[SOLVED] I made the same decision as at the first time I encountered Python, I deleted it and forgot, now for good. :wink: