[英]XMPP connecting to server (Python)
I am currently following a tutorial/getting started on creating a Google Talk Bot 我目前正在关注创建Google Talk Bot的教程/入门
I have made the EchoBot but it fails at runtime with the following error: 我已经制作了EchoBot,但它在运行时因以下错误而失败:
File "echobot.py", line 59, in <module>
if xmpp.connect(('talk.google.com'), '5222'):
File "C:\Python31\Lib\sleekxmpp\clientxmpp.py", line 143, in connect
reattempt=reattempt)
File "C:\Python31\Lib\sleekxmpp\xmlstream\xmlstream.py", line 372, in connect
self.address = (host, int(port))
ValueError: invalid literal for int() with base 10: 'a'
I have tried Python 3,3 , 3,2 and 3,1 interpreter with the same result. 我尝试过Python 3,3,3,2和3,1解释器,结果相同。
I can not get these lines from the tutorial to compile with either of the compilers: 我不能从教程中获取这些代码来编译任何编译器:
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
The code from within the Bot where it fails is as follows: Bot内失败的代码如下:
if xmpp.connect(('talk.google.com'), '5222'):
xmpp.process(block=True)
else:
print('Fekk ikkje kopla til')
Thanks for any tips/help! 感谢您的任何提示/帮助!
You have written something wrong: 你写错了:
xmpp.connect(('talk.google.com', '5222'))
|
there you missed a comma
and the second thing could be to put the port to the second place. 第二件事可能是把港口放到第二位。
xmpp.connect(('talk.google.com', 5222), '5222')
I do not know of the second argument but 我不知道第二个论点但是
Internet Adresses are almost always tuples of (HOST, PORT)
互联网地址几乎总是(HOST, PORT)
元组
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.