GNOME Bugzilla – Bug 616647
gsettings-schema-convert crash
Last modified: 2010-07-02 17:09:54 UTC
I'm getting a "crash" of the script while trying to convert gnome-system-tools's GConf schemas. I've done the conversion manually now, but I guess this bug may hurt other people. Note that it happens on the .schema.in file as well as the .schema file (with translations included). Maybe I'm doing something wrong, but in this case the error message is really not explicit! ;-) gnome-system-tools$ /opt/gnome/bin/gsettings-schema-convert --gconf --xml --schema-id "org.gnome.system-tools" --output org.gnome.system-tools.gschema gnome-system-tools.schemas.in Traceback (most recent call last):
+ Trace 221526
res = main(sys.argv)
output = ET.tostring(tree)
ElementTree(element).write(file, encoding)
assert element is None or iselement(element) AssertionError
http://git.gnome.org/browse/gnome-system-tools/plain/gnome-system-tools.schemas.in?id=75b2947e8fec105704f0bcb3699da0568153c02a And I'm using glib 2.25.2.
Hmm, works ok here.
Actually, it only happens with the --xml option. Else, the file is created fine (but in the other format, of course). The faulty code is the last line of this block: if options.xml: node = schema_root.get_xml_node() tree = ET.ElementTree(node) try: output = ET.tostring(tree, pretty_print = True) except TypeError: # pretty_print only works with lxml output = ET.tostring(tree)
Oh, hrm. Maybe my code when you don't have lxml is wrong. That's some code I was using somewhere else, iirc. Ah, after some investigation, I remember now: I had this issue once before. I think tostring should be called with node instead of tree in this case. I'll attach a patch.
Created attachment 160363 [details] [review] Fix call to tostring()
Nice, it mostly works with the patch, except that everything is on a single line, without returns...
Yes, that's what you get when you don't have lxml. Nothing we can do about it :-) You can use "xmllint --format" to fix that.
OK, one can still add the line breaks manually. Maybe it would be nice to print a notice, because people may prefer to install lxml support instead.
*** Bug 623408 has been marked as a duplicate of this bug. ***
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.