Closed alexandr999 closed 12 years ago
And you are using the del_event_handler() method to do the removing, correct?
no, i just del this handler from my file
Oh, I see. You need to call the constructor for the parent class in your init method.
def __init__(self, jid, password):
super(MyClient, self).__init__(jid, password)
thanks
I have written a mini-example for myself.
/usr/bin/env python3
import logging import time import sleekxmpp
class MyTest (sleekxmpp.ClientXMPP):
def main (): import sys jid = raw_input ("Jid: ") password = raw_input ("Password: ") test = MyTest (jid, password) test.run () while test.status: time.sleep (1)
if name == "main": main ()
I add hadler for presence_probe. Then I remove it. Now when I run this program I get error:
File "./myclient.py", line 39, in
main ()
File "./myclient.py", line 33, in main
client = MyClient (jid, password)
File "./myclient.py", line 10, in init
self.add_event_handler ("session_start", self.handleXMPPConnected)
File "/usr/local/lib/python3.2/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 878, in add_event_handler
if not name in self.event_handlers:
AttributeError: 'MyClient' object has no attribute '_XMLStreamevent_handlers'