Marius
Marius

Reputation: 930

running PyUNO in django

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.

Upvotes: 4

Views: 692

Answers (1)

user2492779
user2492779

Reputation: 101

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.

Upvotes: 2

Related Questions