comparison bot.py @ 20:08cde283621a

Fixed a little bug in exception handling. Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Thu, 20 Aug 2009 14:00:45 +0200
parents c1b84196c100
children 801160b4136f
comparison
equal deleted inserted replaced
19:c1b84196c100 20:08cde283621a
27 from threading import Thread 27 from threading import Thread
28 from bridge import * 28 from bridge import *
29 from time import sleep 29 from time import sleep
30 import re 30 import re
31 import sys 31 import sys
32 import xml.parsers.expat
32 33
33 34
34 class bot(Thread): 35 class bot(Thread):
35 36
36 def __init__(self, jid, password, nickname, error_fd=sys.stderr, debug=False): 37 def __init__(self, jid, password, nickname, error_fd=sys.stderr, debug=False):
81 c.Process(0.5) 82 c.Process(0.5)
82 else: 83 else:
83 sleep(0.5) 84 sleep(0.5)
84 except RuntimeError: 85 except RuntimeError:
85 pass 86 pass
86 except ExpatError: 87 except xml.parsers.expat.ExpatError:
87 self.error('=> Debug: received invalid stanza', debug=True) 88 self.error('=> Debug: received invalid stanza', debug=True)
88 continue 89 continue
89 90
90 91
91 def _xmpp_presence_handler(self, xmpp_c, presence): 92 def _xmpp_presence_handler(self, xmpp_c, presence):