solved: createInstanceWithContext: Binary URP bridge disposed during call

I decided to experiment with OpenOffice automation from Python, found the official PyUNO wiki, followed the “a must read” link PyUNO bridge and tried the proposed hello-world program “hello_world.py“. As it was feared, nothing worked immediately. The error was:

Traceback (most recent call last):
  File "hello.py", line 19, in 
    desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
__main__.RuntimeException: Binary URP bridge disposed during call

The search in Internet was not helpful. Instead, it added confusion.

Fortunately, there was a mention of the tool unoconv, which converts between any document format that OpenOffice understands. I tried it to test if it would fail with the same problem. But it worked perfect.

I opened the source code, found that unoconv does a lot of initialization of the environment and decided to reproduce it. I dumped the environment inside the Convertor::__init__ method:

for i in os.environ.iteritems():
  print '%s=%s' % i

This helped to construct my own initialization:


export URE_BOOTSTRAP=vnd.sun.star.pathname:/usr/lib/libreoffice/program/fundamentalrc
PATH=/usr/lib/libreoffice/program:$PATH
export UNO_PATH=/usr/lib/libreoffice/program
export LD_LIBRARY_PATH=/usr/lib/libreoffice/program:/usr/lib/libreoffice/ure/lib
export PYTHONPATH=/usr/lib/libreoffice/program:$PYTHONPATH

Now “hello_world.py” works as promised.

One Response to “solved: createInstanceWithContext: Binary URP bridge disposed during call”

  1. igor Says:

    install openoffice 4.0.1

Leave a Reply