Hello,
Hoping someone can help me with this problem as I spend the last two days on the internet trying to find a solution but nothing seems to work.
I have recently upgraded from LO 7.6.5.1 to LO 24.2.7.2 (x86_64) as I had this same problem before with 7.6 but I am sure I did not have the same problem with an earlier LO re 6.4.7.1 but I could be mistaken.
Basically I am trying to connect to an open LO session ie Writer for example from running a Python script in the native IDLE(IDE) but it crashes at the following line.
desktop = smgr.createInstanceWithContext( “com.sun.star.frame.Desktop”,ctx)
The error message is as below.
desktop = smgr.createInstanceWithContext( “com.sun.star.frame.Desktop”,ctx)
com.sun.star.uno.RuntimeException: Binary URP bridge disposed during call at C:/cygwin64/home/buildslave/source/libo-core/binaryurp/source/bridge.cxx:613
The strange thing is that I can run the same script from the command line and it connects to a running LO Writer session or Calc etc which was either created by the following line in the External Python script.
subprocess.Popen(‘C:\Program Files\LibreOffice\program\soffice --accept=“socket,host=localhost,port=2002;urp;” --writer’)
or by opening LO as a server from the command line with the line above minus the path.
I have tried adding to the sys paths in Python and the Path Env Var in Windows to point towards the LO program dir among others but that did not make a difference and after 2 days of internet searching for some guidance, in the end throwing my laptop against the wall didn’t do much good either!!!.
I think/guessing it may be to do with either PyUno and what is going on under the bonnet or IDLE is doggedly using the native Python.exe and not the LO Python.exe but I cannot be sure.
All the scripts /OO help etc I have seen are all mostly the same in the connection process and from what I can gather from the comments…they work, but mine just won’t.
I am using IDLE as I want to use Python’s Tkinter(which is all working fine) which in turn I will be connecting to a open LO Writer/Calc session.
What I am doing wrong??
Please can somebody kindly advise me or point me in the right direction.
My setup is as following
Windows 7 SP1
LibreOffice 24.2.7.2(x86_64)
Python (Native) 3.8.18
Sorry for the essay but I wanted to get all the info in.
Many thanks in advance.
P.R