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
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
|
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 :)
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 :)
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.
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.
Examples:
http://packages.debian.org/changelogs/pool/main/libr/libreoffice/libreoffice_3.5.2-2/changelog - search for pythonpath
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-office/libreoffice/files/gentoo-pythonpath.diff?view=log&pathrev=HEAD
https://bugzilla.redhat.com/show_bug.cgi?id=450692
http://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=pythonpath
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.