3

I am trying to test Python UNO api with LibreOffice and It is producing a strange error.

Traceback (most recent call last):
  File "<stdin>", line 16, in <module>
__main__.RuntimeException: Binary URP bridge disposed during call

shell returned 1

Below is my Code:

import socket
import uno
localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
                                   "com.sun.star.bridge.UnoUrlResolver", localContext )
ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop",ctx) //this line is generating error
model = desktop.getCurrentComponent()
text = model.Text
cursor = text.createTextCursor()
text.insertString( cursor, "Hello World", 0 )
ctx.ServiceManager                        

As I mentioned in code, this line is generating error smgr.createInstanceWithContext("com.sun.star.frame.Desktop",ctx)

I am trying to build it upon ARCH LINUX with KDE environment using python3.

Freak
  • 6,786
  • 5
  • 36
  • 54
  • 1
    This error means that LibreOffice crashed or the pyuno bridge crashed. You can see how we use pyuno for connections internally in the Libreoffice code in https://cgit.freedesktop.org/libreoffice/core/tree/uitest/libreoffice/connection.py – moggi May 20 '17 at 04:08
  • Did you use both the libreoffice and python executables both packaged from the same version of libreoffice? (We had that error when the libreoffice was newer and we pointed to a python from an older version of libreoffice) – melutovich Aug 12 '20 at 19:36

0 Answers0