Issue 90701 - PyUNO broken in OOo 3.0 DEV300 with system python
Summary: PyUNO broken in OOo 3.0 DEV300 with system python
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P4 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Keywords: oooqa, regression
Depends on:
Reported: 2008-06-13 15:33 UTC by kendy
Modified: 2017-05-20 11:27 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description kendy 2008-06-13 15:33:46 UTC
Issue 88211 still seems to be valid with system python; or at least I and 
Caolan both fail to run (I tried with m14, Caolan with 

I did some desperate attempts to work it around like exporting 
but so far to no avail :-(

Please - is it a bug, or am I doing something wrong?
Comment 1 Stephan Bergmann 2008-06-13 16:11:23 UTC
@kendy:  You need at least DEV300m19 to get this working at all.

@cmc:  Figuring from your comment to issue 88211 that you are willing to create
a fix for this issue?  ;)  Thanks.

As discussed at
PyUNO is indeed still broken.  For non-SYSTEM_PYTHON, the problem got fixed by
pyuno/zipcore/ (which is installed as
/opt/openoffice.org3/program/python), the two main points probably also relevant
for SYSTEM_PYTHON being to (a) "Set LD_LIBRARY_PATH so that 'import pyuno' finds" and (b) "Set URE_BOOTSTRAP so that 'uno.getComponentContext()'
bootstraps a complete OOo UNO environment".
Comment 2 caolanm 2008-06-13 16:23:26 UTC
Crap, its not like I even know what's going on :-)

wrt. a) finding pyuno. We tweak things a bit to make "import uno" work out of
the box anyway by 

echo "import sys" >
echo "sys.path.append('%{basisinstdir}/program')" >>

and sticking in the system python place. I believe that ooo-build has a
(nasty hardcoded to /usr/lib) rpath to make "import pyuno" work. So...

cmc->kendy: does running the suse system python with
installed and typing into it
import uno
work ?

I'm not sure if that's sufficient, but I assume its necessary anyway.
Comment 3 caolanm 2008-06-13 16:36:23 UTC
So as sb says, If I just do


then it'll work.

Hmm, now for *my* packaging, even with installed, I always have an
openoffice.org3/program/fundamentalrc installed too.

So for me anyway, doing...

echo "import sys, os" >
echo "sys.path.append('%{basisinstdir}/program')" >>
echo "os.putenv('URE_BOOTSTRAP',

would work fine
Comment 4 caolanm 2008-06-13 16:43:27 UTC
So this is new "fixed" for the fedora system python builds.

I guess the question is if this sort of a fix is upstreamable in any sane way
because we'd need to know in advance where OOo will be installed and we don't
know that until we get to instsetoo_native
Comment 5 caolanm 2008-06-13 17:13:59 UTC
If I had total free reign, I'd take the standard configure --libdir argument as
the basis dir that everything gets installed into and tweak the configure
--disable-epm to export a suitable PKGFORMATSWITCH with a -simple DIR of
that_prefix_dir (as a side effect making all distros use LIBDIR/openoffice.org3
and LIBDIR/ as their OOo directories) and make SYSTEM_PYTHON add
into during the build my above lines.
Comment 6 kendy 2008-06-13 17:38:48 UTC
cmc: So, apparently in openSUSE we don't have pyuno working out of the box, 
what I need to do to get it running is

PYTHONPATH=/usr/lib64/ooo-2.0/program python
[where contains just the 'import uno']

According to sb's comment, and with your finding, I hope an additional 
URE_BOOTSTRAP will do it for me when I get to m19 :-)

cmc: Wrt. setting prefixes in the configure, I've filed a bug against is, 
maybe this could go together with it?  It is issue 90430.

pmladek: What do you think, please?
Comment 7 caolanm 2008-06-16 11:37:03 UTC
cmc->kendy: indeed, you either need the debian-esque rpath hack (which would
then need to be extended for the multilib /usr/lib64 on 64bit systems like
suse/redhat) in ooo-build, or you need the 

import sys

hack at the top of like fedora, and the relocation into the "standard"
python locations, here's the dump from my own spec to do the relocation and fixup

%define instdir %{_libdir}
%define baseinstdir %{instdir}/
%define basisinstdir %{baseinstdir}/basis3.0

%define python_py_sitearch %(%{__python} -c "from distutils.sysconfig import
get_python_lib; print get_python_lib(0)")

# move python bits into site-packages
mkdir -p $RPM_BUILD_ROOT/%{python_py_sitearch}
pushd $RPM_BUILD_ROOT/%{python_py_sitearch}
echo "import sys, os" >
echo "sys.path.append('%{basisinstdir}/program')" >>
echo "os.putenv('URE_BOOTSTRAP',
'{oooinstdir}/program/fundamentalrc')" >>
cat $RPM_BUILD_ROOT/%{basisinstdir}/program/ >>
rm -f $RPM_BUILD_ROOT/%{basisinstdir}/program/*
mv -f $RPM_BUILD_ROOT/%{basisinstdir}/program/* .
Comment 8 Stephan Bergmann 2009-04-01 09:06:03 UTC
Re <#desc2>, see issue 97629 for the additional requirement (c) to set the
UNO_PATH environment variable so that can start soffice.
Comment 9 rene 2010-06-23 08:56:32 UTC
FTR, debian in the meanwhile also uses caolans hack because the rpath hack
didn't work anymore :)
Comment 10 Marcus 2017-05-20 11:27:35 UTC
Reset assigne to the default "".