Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The answer is rather simple, make them executable and execute them, if it works depends only on their content -- you do not need to involve soffice -blah -spam whatever in any way

Karolus

The answer is rather simple, make them executable and execute them, if it works depends only on their content -- you do not need to involve soffice -blah -spam whatever in any way

KarolusKarolus

edit:

the common pattern in python-Scripts to distinguish between "run the Script as itself" and "import only some functionality" is at last in the Scriptfile:
...

other stuff

if __name__ == "__main__":
     this()
     that()

in this Case if the script is executed directly it runs only the stuff on module-level and at last the functions this() and that()

And - sorry - but i have to announce:
If you become familiar with ipython notebook you'll dont need all that boilerplate in every script!!

The answer is rather simple, make them executable and execute them, if it works depends only on their content -- you do not need to involve soffice -blah -spam whatever in any way

Karolus

edit:

the common pattern in python-Scripts to distinguish between "run the Script as itself" and "import only some functionality" is at last in the Scriptfile:
...

other stuff

if __name__ == "__main__":
     this()
     that()

in this Case if the script is executed directly it runs only the stuff on module-level and at last the functions this() and that()

And - sorry - but i have to announce:
If you become familiar with ipython notebook you'll dont need all that boilerplate in every script!!

script!!

Edit 2:

Another pattern designed in pythonscript.py for Libreoffice is:

g_exportedScripts = this, that

this pattern make exclusive only the Functions this and that visible and executable over Libre-GUI