J'ai mon propre serveur ejabberd en local et j'essaye de créer un petit bot.
Seulement j'ai une erreur lors de l'exécution du "bot.serve_forever()"
Ci-joint le code python et le fichier d'erreur
--
t...@s
/usr/lib/python2.6/dist-packages/xmpp/auth.py:24: DeprecationWarning: the sha
module is deprecated; use the hashlib module instead
import sha,base64,random,dispatcher,re
/usr/lib/python2.6/dist-packages/xmpp/auth.py:26: DeprecationWarning: the md5
module is deprecated; use hashlib instead
import md5
An error occurred while looking up _xmpp-client._tcp.matrix
/usr/lib/python2.6/dist-packages/xmpp/transports.py:308: DeprecationWarning:
socket.ssl() is deprecated. Use ssl.wrap_socket() instead.
tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None)
Traceback (most recent call last):
File "mybot.py", line 11, in <module>
bot.serve_forever()
File "/usr/lib/python2.6/dist-packages/jabberbot.py", line 401, in
serve_forever
conn = self.connect()
File "/usr/lib/python2.6/dist-packages/jabberbot.py", line 137, in connect
self.roster = self.conn.Roster.getRoster()
File "/usr/lib/python2.6/dist-packages/xmpp/roster.py", line 61, in getRoster
while not self.set: self._owner.Process(10)
File "/usr/lib/python2.6/dist-packages/xmpp/dispatcher.py", line 303, in
dispatch
handler['func'](session,stanza)
File "/usr/lib/python2.6/dist-packages/jabberbot.py", line 250, in
callback_presence
subscription = self.roster.getSubscription(str(jid))
AttributeError: 'Info' object has no attribute 'roster'
from jabberbot import JabberBot, botcmd
import datetime
class Info(JabberBot):
@botcmd
def time(self,mess,args):
"""Affiche la date et l'heure"""
return str(datetime.datetime.now())
bot = Info('b...@matrix','bot')
bot.serve_forever()
_______________________________________________
Ce message est envoyé à tous les abonnés de la liste de discussion
[email protected]
(dés)abonnement: http://dakarlug.org/cgi-bin/mailman/listinfo/libre
Archives: http://www.dakarlug.org/pipermail/libre/
http://dakarlug.org