Launch PyUNO in Django

I have a client running SUSE Enterprise Server 11 that I want to use a django project with OpenOffice-Python-Bridge called PyUNO . It starts apache2 with mod_wsgi and does not have virtualenv or anything else.

I added the appropriate path to PYTHONPATH, but when I started the python manage.py shell and tried import uno , I get this error:

 dynamic module not initialized properly 

This is OpenOffice 3.4, python 2.6.x (both from SUSE-DVD).

Google led me to the LD_LIBRARY_PATH system variable, but as soon as I set it, I can no longer run the shell because python cannot find django (PYTHONPATH seems to be somehow broken). If I run ldconfig -v /path/to/openoffice/program/ , which is another general suggestion, the result will be the same.

After doing one of the above, I can run system-wide python and import uno. But I can not start django-shell anymore because django was not found.

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

OpenOffice comes bundled with the python binary. This can import uno without error.

Result: I was thinking of using another uno.py or somehow told apache2 to use the python version that came with openoffice. How can I do something like this or add the appropriate pyuno dependencies to the python version used by apache? Or what version of openoffice / pyuno can solve my problem? I would like not to touch mod_wsgi and python from SUSE sources.

Some tips on LD_LIBRARY_PATH may also be useful.

+4
source share
1 answer

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

When you install it, for example, export LD_LIBRARY_PATH = / opt / test / mylibs, you make all applications lookups for shared libraries in this place.

This explains why django-shell cannot be started, as it searches for libraries where they do not exist.

The good news is that LD_LIBRARY_PATH can be configured on multiple paths, separated by colons (:). So you can export LD_LIBRARY_PATH = / opt / test / mylibs: / opt / another / path

If you can find all the libraries you need, you can add their paths to LD_LIBRARY_PATH, and this may be enough to solve your problem.

I do not know, however, if this is the real problem that you have encountered, but I think this may give you some idea of ​​the value of this variable.

+2
source

Source: https://habr.com/ru/post/1487455/