Catch ExpatError in xmltodict
Found it, within xmltodict
module itself, so no need to import it separately from xml
module
>>> try: ... xml_dict = xmltodict.parse(xml_data)... except xmltodict.expat.ExpatError:... print "that's right"... that's right