I receive xml strings from an external source that can contains unsanitized user contributed content.
The following xml string gave a ParseError in cElementTre
cElementTre
The only thing that worked for me is I had to add mode and encoding while opening the file like below:
with open(filenames[0], mode='r',encoding='utf-8') as f: readFile()
Otherwise it was failing every time with invalid token error if I simply do this:
f = open(filenames[0], 'r') readFile()