[Libreoffice] PyUno is Python 3 compatible

Andreas Becker atayoohoo at googlemail.com
Mon Apr 18 14:04:52 PDT 2011

now pyuno works with both Python 2 and Python 3.
Summary of the patch:
* Removed pyuno_dlopenwrapper.c and the corresponding stuff in the
   because I do not see any sense in it. It works without dlopenwrapper.
* Removed all tabs in source code, especially in python code and formatted
the python code.
   Python 3 is stricter about indention.
* And of course, I made the C++ code compatible.

To compile with a specific system Python version, just set for example
    PYTHON_LIBS="/usr/lib/libpython2.7.so -lpthread -ldl -lutil"
before running build.

I tested Python 2.7 and Python 3.2, but not the Python that comes with
LibreOffice (it *should* work).
Further testing is a good idea.
Perhaps LibO 3.4 is too early to include the patch, what do you mean?

A problem is, that most of the today's PyUno extensions will break, because
they contain Python 2 code.
PyUno that is compiled with Python 2 cannot be accessed by Python 3 and vice

[Regarding replacing the Java FCFGMerge by the Python version: I did not
forget it, but it is used by other modules than
filters, so I will see what I can do.]

--Andreas Becker

All my code in this e-mail is under LGPLv3+/MPL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110418/81e20857/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyuno_py3k.patch
Type: text/x-patch
Size: 78545 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110418/81e20857/attachment-0001.bin>

More information about the LibreOffice mailing list