Unzipping, editing and zipping ODT documents in python

This is a python script created with a single purpose: to test unzipping of OpenOffice.org (LibreOffice) word processor .odt document file, searching in its contents for a certain text and replacing it with a substitute, and, eventually, zipping it all back together to form a new .odt document.

If you copy and past this text, remember, that HTML formatting may spoil the code, so please check it for any introduced mistakes. Especially since this is python with its indentation issues.


# Just a test script
# Demonstrates unzipping, editing and zipping of ODT documents in python
# Source ODT file "in.odt" shall exist in "/tmp"
# If ODT file contains string token, it will be replaced with string replacement

Read the rest of this entry »