,我發現了以下錯誤:蟒蛇XMPP簡單的客戶端錯誤
AttributeError: Client instance has no attribute 'Dispatcher'
而在Python 2.7運行下面的代碼:
import xmpp
user= '[email protected]'
password="pass"
jid = xmpp.JID(user)
connection = xmpp.Client(jid.getDomain())
connection.connect()
connection.auth(jid.getNode(),password)
會很高興,如果有人知道如何解決它。
P.S.通過N3RO提出的修正後的誤差全部追蹤:
C:\Users\krasnovi\Desktop\temp\xmpp tests>python xmpp.client.py
Invalid debugflag given: always
Invalid debugflag given: nodebuilder
DEBUG:
DEBUG: Debug created for build\bdist.win-amd64\egg\xmpp\client.py
DEBUG: flags defined: always,nodebuilder
DEBUG: socket start Plugging <xmpp.transports.TCPsocket instance at 0x0000
0000027C1708> into <xmpp.client.Client instance at 0x00000000027C1588>
DEBUG: socket warn An error occurred while looking up _xmpp-client._tcp.t
alk.gmail.com
DEBUG: socket error Failed to connect to remote host ('talk.gmail.com', 52
23): getaddrinfo failed (11004)
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\xmpp\transports.py", line 133, in connect
self._sock.connect((server[0], int(server[1])))
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
gaierror: [Errno 11004] getaddrinfo failed
DEBUG: socket stop Plugging <xmpp.transports.TCPsocket instance at 0x0000
0000027C1708> out of <xmpp.client.Client instance at 0x00000000027C1588>.
Traceback (most recent call last):
File "xmpp.client.py", line 11, in <module>
connection.auth(jid.getNode(),password)
File "build\bdist.win-amd64\egg\xmpp\client.py", line 214, in auth
AttributeError: Client instance has no attribute 'Dispatcher'
修復前:
Invalid debugflag given: always
Invalid debugflag given: nodebuilder
DEBUG:
DEBUG: Debug created for build\bdist.win-amd64\egg\xmpp\client.py
DEBUG: flags defined: always,nodebuilder
DEBUG: socket start Plugging <xmpp.transports.TCPsocket instance at 0x0000
0000027ED708> into <xmpp.client.Client instance at 0x00000000027ED588>
DEBUG: socket error Failed to connect to remote host ('xmpp.l.google.com.'
, 5222): A connection attempt failed because the connected party did not properl
y respond after a period of time, or established connection failed because conne
cted host has failed to respond (10060)
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\xmpp\transports.py", line 133, in connect
self._sock.connect((server[0], int(server[1])))
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10060] A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed b
ecause connected host has failed to respond
DEBUG: socket stop Plugging <xmpp.transports.TCPsocket instance at 0x0000
0000027ED708> out of <xmpp.client.Client instance at 0x00000000027ED588>.
Traceback (most recent call last):
File "xmpp.client.py", line 11, in <module>
connection.auth(jid.getNode(),password)
File "build\bdist.win-amd64\egg\xmpp\client.py", line 214, in auth
AttributeError: Client instance has no attribute 'Dispatcher'
請包括錯誤的* full *回溯。 –
@Martijn Pieters。我做到了。 – user1264304
AttributeError似乎是由於超時而導致連接失敗後發生的問題。你是否在防火牆後面? –