From 8269fdbe704dddb4c94eef4eb73a5cdbfb333c9e Mon Sep 17 00:00:00 2001 From: Adrian Insaurralde Avalos Date: Tue, 13 Sep 2022 19:34:43 -0400 Subject: [PATCH] [tools] fix `fcinfo -g` script [skip-ci] ZipFile.read returns a bytes-like object so re.sub must be passed byte-like objects arguments when operating on those read files. --- src/Tools/fcinfo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Tools/fcinfo b/src/Tools/fcinfo index 4ce5f34036..07064d4c68 100755 --- a/src/Tools/fcinfo +++ b/src/Tools/fcinfo @@ -235,11 +235,11 @@ if __name__ == '__main__': doc = zfile.read("Document.xml") if gui and "GuiDocument.xml" in zfile.namelist(): guidoc = zfile.read("GuiDocument.xml") - guidoc = re.sub(r"<\?xml.*?-->"," ",guidoc,flags=re.MULTILINE|re.DOTALL) + guidoc = re.sub(b"<\?xml.*?-->",b" ",guidoc,flags=re.MULTILINE|re.DOTALL) # a valid xml doc can have only one root element. So we need to insert # all the contents of the GUiDocument tag into the main one - doc = re.sub(r"<\/Document>","",doc,flags=re.MULTILINE|re.DOTALL) - guidoc = re.sub(r""," ",guidoc,flags=re.MULTILINE|re.DOTALL) + doc = re.sub(b"<\/Document>",b"",doc,flags=re.MULTILINE|re.DOTALL) + guidoc = re.sub(b"",b" ",guidoc,flags=re.MULTILINE|re.DOTALL) doc += guidoc s = os.path.getsize(sys.argv[-1]) if s < 1024: