Porting a Java extension to Python

Thorsten Behrens thb at documentfoundation.org
Thu May 31 07:35:52 PDT 2012


Michael Meeks wrote:
> 	Cool :-) incidentally, debugging python problems can be really nasty;
> there is some code in this commit:
> 
Since we chatted about that on LinuxTag - what I tend to do, is
install the extension (such that all auxiliary files are available),
start libreoffice with an extra

 --accept="uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"

parameter, and then have

if __name__=="__main__":
    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")
    ctx.ServiceManager...

at the bottom of your Python - so you can run your extension
out-of-process, and use whatever debugging you prefer (interactive,
pdb, etc).

HTH,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120531/005d82be/attachment.pgp>


More information about the LibreOffice mailing list