Technology and Software

LibreOffice, Python3 and AttributeError: ‘NoneType’ object has no attribute ‘supportsService’

I had to run a modified version of the famous script on Ubuntu 14.04. It run on 12.04 well but Ubuntu 14.04 comes with Python3 and the Uno library to interface Python with LibreOffice or OpenOffice doesn’t work.

Solution: convert the script to Python3 (exceptions, print, has_key have been changed) then install these libraries:

sudo apt-get install libreoffice-dev libreoffice-script-provider-python python3-uno

and the program will work. If you fail to install them you’ll get the AttributeError: ‘NoneType’ object has no attribute ‘supportsService’ error because loadComponentFromURL won’t be able to read the input file.