FS#27257 - [libreoffice] python-uno bridge does not work

Attached to Project: Arch Linux
Opened by Jan-Erik Meyer-Luetgens (dracman) - Friday, 25 November 2011, 21:26 GMT
Last edited by Andreas Radke (AndyRTR) - Saturday, 06 April 2013, 18:07 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

I tried to use the Python-UNO bridge as decribed in:

http://udk.openoffice.org/python/python-bridge.html#modes (Mode 2)

So I started libreoffice:

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

and used hello_world.py from that page,
which fails with: ImportError: No module named uno

uno.py (which is part of the libreoffice-common package)
resides in: /usr/lib/libreoffice/basis3.4/program/
so I added it to PYTHONPATH:

$ PYTHONPATH=/usr/lib/libreoffice/basis3.4/program python2 hello_world.py

and got the following error message:

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


Packages:

libreoffice-common 3.4.4-3
libreoffice-writer 3.4.4-3
libreoffice-calc 3.4.4-3
libreoffice-de 3.4.4-1
libreoffice-extension-scripting-python 3.4.4-3
python2 2.7.2-2
openjdk6 6.b22_1.10.4-1
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Saturday, 06 April 2013, 18:07 GMT
Reason for closing:  Fixed
Additional comments about closing:  4.0.2-2; make sure to use python ver.3 now. I confirmed it to work here :)
Comment by Jan-Erik Meyer-Luetgens (dracman) - Friday, 25 November 2011, 21:51 GMT
The hello_world.py program attached...
Comment by Andreas Radke (AndyRTR) - Saturday, 17 March 2012, 07:33 GMT
Please test LibO 3.5.1 - if it's still present please report what has to be changed in the way we package it or look for an upstream issue/report one.
Comment by John Sivak (jsivak) - Wednesday, 21 March 2012, 03:04 GMT
the "new" PythonPath needed in LibreOffice 3.5.x is:
export PYTHONPATH="$PYTHONPATH:/usr/lib/libreoffice/program"

The "old" (pre 3.5.x) would have been:
export PYTHONPATH="$PYTHONPATH:/usr/lib/libreoffice/basis-link/program"

This is probably why the hello_world.py program didn't work initially.
Comment by Dan McGee (toofishes) - Tuesday, 10 April 2012, 03:17 GMT
This fix is totally unacceptable. You are setting a global PYTHONPATH variable for one silly LO extension, and just cost me over an hour of time wondering why pypy would no longer even run a hello world program. To top it off, this file isn't even in the backup array, so now that I've commented it out, it will be overwritten the next upgrade.

https://bugs.pypy.org/issue506

$ export PYTHONPATH="$PYTHONPATH:/usr/lib/libreoffice/program"

$ pypy
'import site' failed
Python 2.7.2 (2346207d99463f299f09f3e151c9d5fa9158f71b, Feb 10 2012, 15:06:33)
[PyPy 1.8.0 with GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
debug: OperationError:
debug: operror-type: AttributeError
debug: operror-value: 'module' object has no attribute 'warn'

Please revert this change. Upstream needs to set this environment variable if necessary during program invocation, globally is not the answer.

Sorry if I sound pissed off here, but I am. I'd be glad to test other "solutions" to this, but this as stands does a whole lot of damage, as it totally prevents PyPy from running.
Comment by John Sivak (jsivak) - Tuesday, 10 April 2012, 13:00 GMT
Sorry if my comment implied a change to the PYTHONPATH system wide.. I only set the PYTHONPATH to include "/usr/lib/libreoffice/program" in the scripts that need the libreoffice packages..

Comment by Andreas Radke (AndyRTR) - Tuesday, 10 April 2012, 15:42 GMT Comment by Andreas Radke (AndyRTR) - Sunday, 13 May 2012, 06:13 GMT
I'm reverting that change until we find a proper solution to set the path.
Comment by Andreas Radke (AndyRTR) - Sunday, 20 May 2012, 10:39 GMT
Can you please check, if applying this Debian patch would fix it and still work in 3.5.x ?
Comment by Andreas Radke (AndyRTR) - Wednesday, 06 June 2012, 09:53 GMT
Anyone willing to test that?
Comment by Andreas Radke (AndyRTR) - Friday, 05 October 2012, 05:12 GMT
3.6.2 has it the Debian patch applied. So our path should work well. But simple tests keep failing.

I have no clue if we need further patching or if somewhere in the build process a shebang breaks or what else.

Maybe someone is interested to look deeper into this.
Comment by Greg (dolby) - Saturday, 17 November 2012, 02:14 GMT
Status?

Loading...