From c36073b40e2caef337511fa3a4e386dce5449bd2 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sun, 19 Feb 2012 20:27:19 -0800 Subject: xml.etree.ElementTree raises ExpatError instead of SyntaxError or ParseError. --- sleekxmpp/xmlstream/xmlstream.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sleekxmpp/xmlstream') diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index f626eb00..4c4b1ebb 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -31,6 +31,8 @@ try: except ImportError: import Queue as queue +from xml.parsers.expat import ExpatError + import sleekxmpp from sleekxmpp.thirdparty.statemachine import StateMachine from sleekxmpp.xmlstream import Scheduler, tostring @@ -1241,7 +1243,7 @@ class XMLStream(object): except SystemExit: log.debug("SystemExit in _process") shutdown = True - except SyntaxError as e: + except (SyntaxError, ExpatError) as e: log.error("Error reading from XML stream.") self.exception(e) except Socket.error as serr: -- cgit v1.2.3