Libreoffice
macro shell function work fine when shell, PHP or something not python,
But shell("x.py")
is forced use only embedded python. I want to use external python , maybe some work around exists.
Asked
Active
Viewed 1,620 times
0

Mi-Creativity
- 9,554
- 10
- 38
- 47

Tadashi Nagao
- 75
- 1
- 6
-
What does your code need to do that "embedded python" cannot do? – Jim K Dec 17 '15 at 18:42
2 Answers
2
I assume you are asking about calling from a LibreOffice Basic macro, because Shell is a Basic function. For example, maybe your code looks like:
Sub CallPython
filepath = "C:\Python33\python.exe C:\OurDocs\x.py"
Shell(filepath,2)
End Sub
I wonder what "embedded python" version your system is using. To find out, put this code in x.py:
import sys
# change this path to a directory located on your system
with open("c:/users/jimstandard/desktop/x.txt", 'w') as f:
f.write(sys.version)
To use a different version of Python, use a different path in the filepath
variable above.
I often use Python with LibreOffice, but I do not do it this way. Instead, I write macros using PyUNO, which typically does not involve Basic at all. Perhaps this is what you are really trying to do. All of the macro code goes in the Python file, and gets written in Python instead of Basic.
For information on how to use PyUNO, see https://wiki.openoffice.org/wiki/Python.

Jim K
- 12,824
- 2
- 22
- 51