[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#653967: python-uno: LibreOffice crashes when creating or opening documents in Python scripts



Package: python-uno
Version: 1:3.4.3-3~bpo60+1
Severity: important

LibreOffice crashes with

com.sun.star.lang.DisposedException: Binary URP bridge disposed during call

when opening or creating documents.  All this error means is that the script
has detected that LibreOffice has crashed.

Attached (I hope) is a script that exhibits the undesirable behaviour. This is
an adaptation of the hello.py script from OpenOffice.org.  The original
assumes a writer document is already open.  The adaptation creates a new
draw document. It should fail on line 26 with Attribute Error (a script error)
but instead fails on line 24 with the DisposedException.

LibreOffice was started (beforehand) with:

  libreoffice --"accept=socket,host=localhost,port=2002;urp"

This script works with other types of document but this is not a draw issue:
I have other scenarios where writer, calc or impress documents crash LibO.

I have download and installed LibO 3.3.4rc1, 3.4.4rc2 and 3.4.5rc1 from the
LibreOffice web site and the script runs fine with these (as do all my other
scripts) provided I use the Python 2.6.1 bundled with LibO.

The script also works fine under Debian Testing with LibreOffice 3.4.4 and
Python 2.7.2+.

I tentatively conclude this is an issue with the backport itself. As it stands,
pyuno is too unstable to use.


-- System Information:
Debian Release: 6.0.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-uno depends on:
ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib
ii  libgcc1                1:4.4.5-8         GCC support library
ii libpython2.6 2.6.6-8+b1 Shared Python runtime library (ver ii libreoffice-core 1:3.4.3-3~bpo60+1 office productivity suite -- arch-
ii  libstdc++6             4.4.5-8           The GNU Standard C++ Library v3
ii python 2.6.6-3+squeeze6 interactive high-level object-orie ii python2.6 2.6.6-8+b1 An interactive high-level object-o ii ure 3.4.3-3~bpo60+1 LibreOffice UNO runtime environmen

python-uno recommends no packages.

python-uno suggests no packages.

-- no debconf information

--
Paul Bryan Roberts
paulbryan.roberts@yahoo.co.uk

# -*- coding: utf-8 -*-
#import socket  # only needed on win32-OOo3.0.0
import uno

# get the uno component context from the PyUNO runtime
localContext = uno.getComponentContext()

# create the UnoUrlResolver
resolver = localContext.ServiceManager.createInstanceWithContext(
				"com.sun.star.bridge.UnoUrlResolver", localContext )

# connect to the running office
#ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
smgr = ctx.ServiceManager

# get the central desktop object
desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)

# create a new draw document
model = desktop.loadComponentFromURL("private:factory/sdraw", "_blank", 0, ())

# access the current writer document
#model = desktop.getCurrentComponent()

# access the document's text property
text = model.Text

# create a cursor
cursor = text.createTextCursor()

# insert the text into the document
text.insertString( cursor, "Hello World", 0 )

# Do a nasty thing before exiting the python process. In case the
# last call is a oneway call (e.g. see idl-spec of insertString),
# it must be forced out of the remote-bridge caches before python
# exits the process. Otherwise, the oneway call may or may not reach
# the target object.
# I do this here by calling a cheap synchronous call (getPropertyValue).
ctx.ServiceManager

Reply to: