0

I am currently following a tutorial/getting started on creating a Google Talk Bot

I have made the EchoBot but it fails at runtime with the following error:

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.

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:

if xmpp.connect(('talk.google.com'), '5222'):
    xmpp.process(block=True)
else:
    print('Fekk ikkje kopla til')

Thanks for any tips/help!

1 Answer 1

2

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)

1
  • 1
    Thank you, it was the comma! Appreciated. This worked: xmpp.connect(('talk.google.com', '5222')):
    – Are
    Apr 25, 2013 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.