trivial: Fix compile when using python 3.7 or older

Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
Khem Raj 2022-09-20 15:10:26 +01:00 committed by Richard Hughes
parent 9df226ca08
commit e9964a0f96

View File

@ -23,6 +23,9 @@ for fn in sorted(sys.argv[2:]):
n_file.set("preprocess", "xml-stripblanks")
n_file.set("alias", os.path.basename(fn))
with open(sys.argv[1], "wb") as f:
f.write(ET.tostring(root, "utf-8", xml_declaration=True))
try:
f.write(ET.tostring(root, "utf-8", xml_declaration=True))
except TypeError:
f.write(ET.tostring(root, "utf-8"))
sys.exit(0)