2013-08-23 8 views
5

मैं निम्न त्रुटि हो रही है:अजगर xmpp सरल ग्राहक त्रुटि

AttributeError: Client instance has no attribute 'Dispatcher' 

अजगर 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) 

खुशी होगी।

पीएस 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' 
+0

कृपया त्रुटि के लिए * पूर्ण * ट्रेसबैक शामिल करें। –

+0

@ मार्टिजन पीटर्स। मैंने किया। – user1264304

+1

एट्रिब्यूट एरर एक समस्या है जो * टाइम * के कारण कनेक्शन विफल होने के बाद होता है। क्या आप फ़ायरवॉल के पीछे हैं? –

उत्तर

3

आप एक सर्वर से कनेक्ट करना चाहते हैं निर्दिष्ट करने की आवश्यकता।

connection.connect(server=('serveradress.com', portnumber)) 

इसे बदलने के बाद मैं विशेषता Error पुन: पेश नहीं कर सका।

मैं आपको अपने कोड का परीक्षण करने के लिए एक सही जेआईडी का उपयोग करने की सलाह भी दूंगा। जेआईडी ई-मेल की तरह एक @ से अलग हैं, यही कारण है कि आपके नमूना कोड jid.getNode() में कुछ भी नहीं देता है।

import xmpp 

user = '[email protected]' 
password = 'password' 

jid = xmpp.JID(user) 

connection = xmpp.Client(jid.getDomain()) 
connection.connect(server=('talk.google.com', 5223)) 
connection.auth(jid.getNode(), password) 
connection.sendInitPresence() 
+0

धन्यवाद। मुझे अभी भी त्रुटि मिल रही है, आप मेरे संपादित प्रश्न में पूर्ण ट्रेसबैक देख सकते हैं। क्षमा करें, मैंने इसे प्रश्न में ठीक कर दिया है। असल में, मेरे पास मेरे कोड में असली जेआईडी है। – user1264304

+0

मैंने अपने काम में अपना कामकाजी कोड जोड़ा। मुझे उम्मीद है कि आपकी मदद कर सकता है। – N3RO

+0

@ एन 3 आरओ। धन्यवाद, यह मेरे घर पर काम करता था, लेकिन डोमेन नेटवर्क से जुड़े कंप्यूटर पर नहीं। – user1264304

3

अपने ट्रैसबैक में यह लग रहा है आप talk.gmail.com जो एक गैर विद्यमान डोमेन है से कनेक्ट करने की कोशिश कर रहे हैं, इसलिए connection.connect बयान एक कनेक्शन को खोलने के लिए असफल हो जायेगी की तरह:

* मेरी कोड उदाहरण को संपादित करें।

talk.google.com से कनेक्ट करने का प्रयास करें जो सही सर्वर का नाम हो सकता है।

संबंधित मुद्दे