The example: https://help.libreoffice.org/6.3/en-US/text/sbasic/python/python_shell.html?&DbPAR=BASIC&System=UNIX
Only work if LibreOffice is installed manuality, but not, if used the version of the distribution, because generally this versions used the Python Core the system, for this case:
Steps to Reproduce:
Only if used LibreOffice of the distribution
1. Copy and paste script
Show interpreter console
User Profile Reset: No
Some distribution do not include LibreOffice Python Scripting Framework and propose it as an option e.g. ZorinOS
Some distribution propose LibreOffice Python Scripting Framework by default e.g.
I assume the help system is not meant to document the various installations and packages available in Linux distributions.
However the presence of Python macros examples when selecting "Run macros.." is an indication that Python Scripting Framework is installed. It may be worth mentioning this in the wiki if not in the online help.
example Python macros are:
NamesRanges (New btw)
SetCellColor (New btw, no licence in this one)
Yes, I know, but 90% of users, use LibreOffice of distribution, so, 90% of cases, this code not will work.
Only, add "tip" or note for this.
and add "return" to function.
if not work, perhaps (generaly) the user assume it's LibreOffice
A 'note' enabling user check shall be added in the help.
Assigned to myself.
As for the 'return' hint, here's what PEP8 says:
Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None , and an explicit return statement should be present at the end of the function (if reachable).
return statement shall be removed
"Either all return statements in a function should return an expression, or none of them should"
I thing, for new users, it's better always used Return
By the way, PEP8 says for imports:
Yes: import os
No: import sys, os
Python main page updated with Python framework check recommandation.
As for the import and return remarks, code is left AS IS for conciseness although not perfectly PEP 8 compliant. Please 'import this' for more.