pyuno broken in app-office/libreoffice-3.4.2.3. In 3.3.3 all right. Reproducible: Always Steps to Reproduce: 1. USE="odk java" emerge =libreoffice-3.4.2.3 2. create new file: $ cat test.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys sys.path.append('/usr/lib/libreoffice/basis-link/program') import os import uno #a UNO struct later needed to create a document from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK from com.sun.star.text.TextContentAnchorType import AS_CHARACTER 3. execute script: $ python test.py Actual Results: executing with errors: Traceback (most recent call last): File "test.py", line 9, in <module> from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK File "/usr/lib/libreoffice/basis-link/program/uno.py", line 291, in _uno_import raise ImportError( "type "+ name + "." +x + " is unknown" ) ImportError: type com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK is unknown Expected Results: executing without errors Found out similar problem: https://bugs.archlinux.org/task/23733 https://bugs.freedesktop.org/show_bug.cgi?id=37037 On the basis of this was obtained a patch, which solves the problem: --- /usr/lib/libreoffice/basis-link/program/uno.py_orig 2011-08-09 00:26:36.000000000 +0700 +++ /usr/lib/libreoffice/basis-link/program/uno.py 2011-08-15 10:41:26.000000000 +0700 @@ -25,7 +25,11 @@ # #************************************************************************* import sys +import os +sys.path.append('/usr/lib/libreoffice/basis-link/program') +if getattr(os.environ, 'URE_BOOTSTRAP', None) is None: + os.environ['URE_BOOTSTRAP'] = "vnd.sun.star.pathname:/usr/lib/libreoffice/program/fundamentalrc" import pyuno import __builtin__ import socket # since on Windows sal3.dll no longer calls WSAStartup Please, fix it. Thanks.
It looks like it is broken even more as it is not multilib strict safe. :) Anyway you should sent your patch to libreoffice@lists.freedesktop.org to get it accepted upstream. Until it is not accepted upstream we won't add it to main tree.
(In reply to comment #1) > It looks like it is broken even more as it is not multilib strict safe. :) > So replace /usr to ${exec_prefix} Look https://bugs.archlinux.org/task/23733 please I do not think I have the skills to talk to upstream. I can only say that in earlier versions uno.py contain these lines.
So, upstream said it Gentoo bug https://bugs.freedesktop.org/show_bug.cgi?id=40168#c1
same on 3.4.3.1
So I tried to consolidate those patches: http://dev.gentooexperimental.org/~scarabeus/libreo/0001-Try-to-make-pyuno-work-with-system-python.patch Also sent upstream for review, when done i will add it to the portage so it gets applied automatically. In meantime feel free to test it yourself :)
I tried to put this patch on 3.4.3.1 If this is done after ebuild ... unpack, geting errors config.status: creating Makefile config.status: creating bin/repo-list config.status: error: cannot find input file: `pyuno/source/module/uno.py.in' If this is done after ebuild ... prepare, macro does not run and uno.py contains the following lines sys.path.append('@libdir@/@OOOINSTALLDIRNAME@/basis-link/program') if getattr(os.environ, 'URE_BOOTSTRAP', None) is None: os.environ['URE_BOOTSTRAP'] = "vnd.sun.star.pathname:@libdir@/@OOOINSTALLDIRNAME@/program/fundamentalrc"
(In reply to comment #6) If you look at the patch, you can see it is a generated by git. I unfortunately do not know how to tell /usr/bin/patch to rename uno.py to uno.py.in like the patch file says (for all I know that might be a git-only feature), but the patch works if you just remember to do it manually after patching. Compiling as we speak, hope it completes this time :)
Any news?
Patch is still needed for app-office/libreoffice-3.4.4. After patching it works fine for me on ~amd64. # emerge -pv app-office/libreoffice These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] app-office/libreoffice-3.4.4.2-r1 USE="branding dbus gstreamer gtk java kde mysql opengl python vba (-aqua) -binfilter -custom-cflags -debug -eds -gnome -graphite -jemalloc (-kdeenablefinal) -nsplugin -odk -pdfimport -templates -test -webdav" LINGUAS="-de -en_GB -en_ZA -es -fr -hu -it" 0 kB Total: 1 package (1 reinstall), Size of downloads: 0 kB
Created attachment 294923 [details] strace.out strace python2.7 test.py -f &> /tmp/strace.out
Sorry, I posted a wrong direction. This should have been published in #392883
Patch is still needed on 3.4.99.3
This bug has references to libreoffice-3.4.2.3, libreoffice-3.4.4, and 3.4.99.3. Since none of these ebuilds exist in the Portage tree anymore, can this bug be closed?
On 3.4.5.2 and 3.5.0-r2 bug is not reproduced. In my opinion, the bug can be closed.
I'm sorry, but I was wrong. A bug exists, but plays a little differently. Reproduced as follows. 1. In the first terminal, run the following command office: $ soffice "--accept=socket,host=localhost,port=2002;urp;" --invisible 2. Create a file with the following contents: $ cat out.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys sys.path.append('/usr/lib/libreoffice/program') sys.path.append('/usr/lib/libreoffice/basis-link/program') import os import uno goServiceManager = False def getServiceManager( cHost="localhost", cPort="2002" ): global goServiceManager connectionFlag = 0 oContext = 0 if not goServiceManager: oLocalContext = uno.getComponentContext() oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", oLocalContext ) while oContext == 0: oContext = getContext(oLocalResolver, cHost, cPort) connectionFlag = connectionFlag + 1 print connectionFlag goServiceManager = oContext.ServiceManager return goServiceManager def createUnoService( cClass ): oServiceManager = getServiceManager() oObj = oServiceManager.createInstance( cClass ) return oObj def getContext(oLocalResolver, cHost="localhost", cPort="2002"): try: oContext = oLocalResolver.resolve( "uno:socket,host=" + cHost + ",port=" + cPort + ";urp;StarOffice.ComponentContext" ) print "getContext" except: oContext = 0 print "\n getContext is false \n" time.sleep(2) return oContext createUnoService("com.sun.star.frame.Desktop") 3. Run: $ python out.py Result: Traceback (most recent call last): File "out.py", line 37, in <module> createUnoService("com.sun.star.frame.Desktop") File "out.py", line 25, in createUnoService oObj = oServiceManager.createInstance( cClass ) __main__.RuntimeException: Binary URP bridge disposed during call If set URE_BOOTSTRAP="file:///usr/lib/libreoffice/program/fundamentalrc", command is executed without traceback.
Created attachment 301337 [details] out.py file to reproduce the bug
Reproduced on libreoffice-3.5.0.1, libreoffice-3.4.5.2 and libreoffice-bin-3.4.3.2-r1
This bug is fixed in 3.5.9999 and 9999 ebuilds. Thus it should be working staring in 3.5.1. Please reopen if it is still not fixed for you.