Description: Hi, I found that Python scripts can't be embedded in flat ODS files in calc at least. I'm currently using an extension called APSO (https://extensions.libreoffice.org/en/extensions/show/apso-alternative-script-organizer-for-python). I found that apparently, python scripts, in classical ODS .zip hierarchy, are stored in subfolder Scripts/python according to this website: https://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html (see section: Pack your script inside the document : the OpenDocument format) However when creating a BASIC script, it is properly embedded in the XML file using the token <ooo:library-embedded> After watching quickly the source code, I think it is a missing feature rather than a bug of Libreoffice calc. I'm currently running 7.6.7.2 on Linux. Any help on this? Thanks! Steps to Reproduce: 1. Install APSO extension 2. Go to Tools->Maccro->Manage Python scripts 3. Create a new Python module & scripts 4. Try to save your document as (flat) fods format Actual Results: Python script vanish from the fods file Expected Results: Python script should be embedded inside the fods file. Reproducible: Always User Profile Reset: No Additional Info: Version: 7.6.7.2 (X86_64) Build ID: 60(Build:2) CPU threads: 4; OS: Linux 6.9; UI render: default; VCL: gtk3 Locale: en-GB (fr_FR.UTF-8); UI: en-GB Calc: threaded
Cross posted here: https://gitlab.com/jmzambon/apso/-/issues/49 I would say this is an Apso issue.
(In reply to Rafael Lima from comment #1) > > I would say this is an Apso issue. I would say this is nonsense! 1. Apso stores the python-code the **regular** way into the __in_memory_file_tree__, nothing else! 2. Apso can neither predict that $User will later save to "fods" format... 3. ...and even less magically deliver a possibly missing specification for "fodf"-xml and|or the missing Implementation in contrast to Basic. @Regina: Do you know somthing about fodf-specification related to embedding-python-code?
There is no formal obstacle. The existing element <office:script> (3.1, part 3, ODF 1.3) and its attribute 'script:language' (19.434, part 3, ODF 1.3) would allow to embed Python scripts. I see a larger problem in the fact, that there is no UI for Python scripts other than to run them. From a security point of view, it should at least be possible to read the source of embedded scripts and to remove an embedded script, without the need to install an extension.
(In reply to Regina Henschel from comment #3) > There is no formal obstacle. The existing element <office:script> (3.1, part > 3, ODF 1.3) and its attribute 'script:language' (19.434, part 3, ODF 1.3) > would allow to embed Python scripts. but from my observation, a file with both embedded basic *and* embedded python, stored to **fods** … the basic-code is stored in a node like: ___ <office:scripts> <office:script script:language="ooo:Basic"> <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"> <ooo:library-embedded ooo:name="Standard"> <ooo:module ooo:name="Module1"> <ooo:source-code>REM ***** BASIC ***** Sub Main 'does nothing End Sub </ooo:source-code> </ooo:module> </ooo:library-embedded> </ooo:libraries> </office:script> </office:scripts> ___ but as you can see, the python code has disappeared without a trace! see the attached file as »ods« and as »fods« (In reply to Regina Henschel from comment #3) > > I see a larger problem in the fact, that there is no UI for Python scripts > other than to run them. From a security point of view, it should at least be > possible to read the source of embedded scripts and to remove an embedded > script, without the need to install an extension. fair enough! … from my point of view there is also a security-risk to have a ~30Kloc huge project directly in the sourcecode of LO ( … ) which cannot be disabled nor removed!
Created attachment 195124 [details] ods_file_with_embedded_python and basic
Created attachment 195125 [details] the same file stored as »fods«
Hey folks -- any update on this? If you guide me on the implementation (what to do and where in the code) I can make a contribution. Thanks!