Hello!
I'm writing a little script that takes an openoffice file as a
template, opens it up, replaces all the tags it can find, and saves it
under a different filename.
For those that don't know, the format of the openoffice files is a
zipped set of files, some of which are xml files, some of which are
images, and some of which are folders that can be empty.
So my script opens the zipfile, reads 'content.xml', and then saves
the lot with the following function:
def save(self,saveFileName="OO_Nota_converted.odt"):
###saves the modified file###
savefile = zipfile.ZipFile(saveFileName,'w')
for info in self.templateFile.infolist():
savefile.writestr(info,self.templateFile.read(info.filename))
savefile.writestr(zipfile.ZipInfo("content.xml"),self.content)
My problem is that while this function works great with python, it
produces corrupt zipfiles with jython. I suspect it's because some of
the directories are empty, but I don't know why python can handle that
and jython can't.
Any thought are appreciated.
David
|