Uno unmarshal XDesktop2 exception from createInstanceWithContext

I have a python script that creates libreoffice spreadsheets. I’ve turned on some extra debugging from the python uno stuff. Here is the exception / debug info:

warn:binaryurp:687968:687976:binaryurp/source/reader.cxx:124: caught UNO exception ‘N3com3sun4star3uno9ExceptionE msg: binaryurp::Unmarshal: type with unknown name: com.sun.star.frame.XDesktop2 at <source_path>/libreoffice/binaryurp/source/unmarshal.cxx:167’

I start libreoffice like this:

/usr/local/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nofirststartwizard --nologo --norestore --accept=socket,host=localhost,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext

The connection setup looks like this:
sys.path.append("/usr/local/lib/libreoffice/program")
import uno
import pyuno
from com.sun.star.uno import RuntimeException

local_ctx = uno.getComponentContext()
smgr_local = local_ctx.ServiceManager
resolver_name = "com.sun.star.bridge.UnoUrlResolver"
resolver = smgr_local.createInstanceWithContext(resolver_name, local_ctx)
url = "uno:socket,host=localhost,port=2002,tcpNoDelay=1;" \
    + "urp;StarOffice.ComponentContext"
uno_ctx = resolver.resolve(url)
uno_smgr = uno_ctx.ServiceManager
desktop = uno_smgr.createInstanceWithContext("com.sun.star.frame.Desktop", uno_ctx)

Any clues or pointers to working python/uno could is appreciated.

:wink: