[lxml-dev] Serialization to file does not report error

Jan. 28, 2009
6:51 a.m.
I use the following code to serialize a tree to a file: tree.write(self.__fileName, pretty_print=True, xml_declaration=True) if the file pointed by self.__fileName is not writable (not owned by the current user), the call silently exits, but the file is not written. I have to use: file_ = file(self.__fileName, 'w') tree.write(file_, pretty_print=True, xml_declaration=True) file_.close() to catch en exception in this case. I'm using lxml 1.1.1; this is an old version (from debian etch), and it might have been corrected in new release... -- Frédéric
5869
Age (days ago)
5870
Last active (days ago)
2 comments
2 participants
participants (2)
-
Frédéric Mantegazza
-
Stefan Behnel