Hello. I want to use external Python IDE (PyCharm) to editing Libre scripts on win comp. I’ve read the topic 'Start LibreOffice with socket settings" on Creating Python Scripts with ScriptForge obout work with sockets. Then I started Libre with parametrs ./soffice --accept=‘socket,host=localhost,port=2021;urp;’ as written. Libra has started, but I can’t connect to nither Python nor telnet localhost 2021. Please help
If you are on a Windows system, you need to use Windows command line conventions. E.g., you can’t use single quotes there. Try double quotes instead.
so doublecheck the pycharm-python-interpreter is the same as the LO-python-interpreter and try:
#import sys
import uno
from pythonscript import ScriptContext
#from rich import print
PIPENAME = "…………………………"
# args = f"pipe,name={PIPENAME}"
args = "socket,host=localhost,port=2021"
local = uno.getComponentContext()
resolver = local.ServiceManager.createInstance("com.sun.star.bridge.UnoUrlResolver")
ctx = resolver.resolve( f"uno:{args};"
"urp;"
"StarOffice.ComponentContext")
createUnoService = ctx.ServiceManager.createInstance
XSCRIPTCONTEXT = ScriptContext( ctx , None, None )
#test:
doc = XSCRIPTCONTEXT.getDocument()
print( doc.Title )
Great! My socket connection works with command line. But I still do something wrong and can’t connect to Libra whith PyCharm, if somebody has such experience?
Did you read, understand, and follow my last comment?
Oh, yes, thanks it works after I’ve changed my python interpreter in PyCharm to Libra’s in cd C:\Program Files\LibreOffice\program. But… I don’t have a virtual env now and if I wish to instal any other Python module e.g. pandas, sklearn… may I do this? I did’t try, just want to understand