Easy install the pyuno library with buildout

This recipe was started by Infrae, I have added the pyuno egg creation within the recipe. It is so nice to be able to share code so easily !

Download OpenOffice in a buildout might sound odd but

  • You got used (and I think you are right) to isolate your python environment for each projects (e.g using buildout & virtualenv)
  • You want to control OpenOffice components with your favourite python using the official OpenOffice library: pyuno
  • If you already installed OpenOffice, you might not see how to link your favourite python with the pyuno library provided by the OpenOffice package of your favourite distribution

The python uno library (aka pyuno) is only delivered with OpenOffice. The library provides access to all OpenOffice UNO api which means:

  • read and write doc, odt, rdf, xls and the most common file extension known in the different well known office suites
  • generate nice pdf
  • no xml parsing/transforms when you want to read odt & co
  • fill in templates with content (e.g. pod)
  • drawing shapes
  • … (you might want to have a look at the OO developper guide for more informations even if there is lot’s of java examples )

The only major disadvantage is that it requires to connect to an openoffice process. This can be a problem if your sysadmin don’t want to install a real X server in a production environment but this disadvantage is quickly fixed if you install and use Xvfb

This recipe can

  • download OpenOffice from any url (default to OpenOffice 2.3) and extract it in your buildout
  • replace the default python interpreter delivered with OO with the one you are using in your buildout
  • create an egg with pyuno and link it inside your buildout

More info about installation and usage of this recipe on pypi

Linux is only supported by now (and I don’t want to be sorry for not having a mac), if you want to fix this the code is here ;)