4

I've got a customer running a SUSE Enterprise Server 11, on which I want to use a django-project with the OpenOffice-Python-Bridge called PyUNO. It runs an apache2 with mod_wsgi and doesn't have a virtualenv or something.

I added the relevant path to PYTHONPATH, but when I run a shell python manage.py shell and try import uno, I get this error:

dynamic module not initialized properly

It's OpenOffice 3.4, python 2.6.x (both from the SUSE-DVD).

Google led me to a system-variable LD_LIBRARY_PATH, but as soon as I set it, I can't start the shell any more because python cannot find django any more (PYTHONPATH seems to be broken somehow). If I run ldconfig -v /path/to/openoffice/program/ which is another common proposal, the result is the same.

After doing one of the above, I can run system-wide python and import uno. But I cannot run django-shell any more because django is not found.

If I reset LD_LIBRARY_PATH (via unset LD_LIBRARY_PATH or ldconfig), I get to the "old" situation.

OpenOffice comes bundled with a python-binary. This one may import uno without the error.

Result: I thought about using another uno.py or somehow tell apache2 to use the python-version which came with openoffice. How can I do something like this or add the relevant pyuno-dependencies to the python-version used by the apache? Or which version of openoffice/pyuno could solve my problem? I would like to avoid touching mod_wsgi and python from the SUSE-sources.

Also some hints about LD_LIBRARY_PATH could be helpful.

Marius
  • 930
  • 1
  • 9
  • 28
  • Does it work if you set `LD_LIBRARY_PATH` instead of `LD_CONFIG_PATH`? – Aya Jun 24 '13 at 20:38
  • Ahh, I'm sorry. That was the variable I already used. I'll edit the question. – Marius Jun 25 '13 at 06:15
  • Well, if you can import django modules when `LD_LIBRARY_PATH` is unset, then simply setting `LD_LIBRARY_PATH` shouldn't cause it to fail, nor should it affect `PYTHONPATH`. What's the exact error message you get when running the django shell? – Aya Jun 25 '13 at 11:44
  • It does not find django any more, if I also add the django-path, it fails at "import os". So it's no helpful way to customize this path. It is also not sure if importing uno would work afterwards... – Marius Jul 10 '13 at 13:13

1 Answers1

2

LD_LIBRARY_PATH is a variable that overrides the search path for shared libraries (.so typically).

When you set it, for example, export LD_LIBRARY_PATH=/opt/test/mylibs you make all applications search for shared libraries at that location.

This explains why django-shell can't be run, because it's searching for libraries where they don't exist.

The good news is that LD_LIBRARY_PATH can be set to several paths, separated by colons (:). This way, you can export LD_LIBRARY_PATH=/opt/test/mylibs:/opt/another/path

If you manage to find where all the libraries you need are located, you can append their paths to LD_LIBRARY_PATH, and it may be enough to solve your problem.

I don't know, however if this is the true problem you're facing, but I think this may give you some hindsight on the meaning of this variable.

user2492779
  • 101
  • 2
  • Mh, that could help me. At least it's worth a try. But I need the actual LD_LIBRARY_PATH for this so that I can add the relevant path without overwriting the old entries. I'll try to add my missing path to /etc/ld.so.conf and re-run ldconfig. Hopefully it will help. – Marius Jun 27 '13 at 07:32
  • Adding the path to openoffice/program to /etc/ld.so.conf.d/*.conf did not help. – Marius Jul 10 '13 at 13:15