Fix a NameError: global name ‘OPENOFFICE_BIN’ is not defined in LibreOffice
Just minutes ago I upgraded to Kubuntu 11.04. I noticed that OpenOffice has been replaced with LibreOffice (yay!) so I ran a critical python-based OpenOffice script that I use, expecting it to break. It did break, but the fix is easy.
Here’s the error that the script threw:
NameError: global name 'OPENOFFICE_BIN' is not defined
All I did was to locate where LibreOffice put itself and add that to the script. In my script there’s a section that looks like this:
# Find OpenOffice.
_oopaths=(
('/usr/lib64/ooo-2.0/program', '/usr/lib64/ooo-2.0/program'),
('/usr/lib/openoffice/program', '/opt/openoffice.org/basis3.1/program'),
)
See that first instance of /usr/lib64/ooo-2.0/program? I replaced it with /usr/lib64/libreoffice/program and now the script works perfectly. Never in a million years would I expect this with an upgrade from a proprietary vendor. Once again, free open source software just saved me lots of time and money.
New script looks like this:
# Find OpenOffice.
_oopaths=(
('/usr/lib64/libreoffice/program', '/usr/lib64/ooo-2.0/program'),
('/usr/lib/openoffice/program', '/opt/openoffice.org/basis3.1/program'),
)
