Created
March 27, 2011 17:47
-
-
Save moos3/889406 to your computer and use it in GitHub Desktop.
TCPClient doesn't like irc_settings['server']
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irc_settings = { | |
'server':'irc.freenode.net', | |
'port': '6667', | |
'username' : '<username>', | |
'password' : '<password>', | |
'nick' : 'Annuska', | |
'nick_password' : '<nick_password>', | |
'ssl': False, | |
'channels': '#testing_moose', | |
} | |
class AnnuskaIRCactory(protocol.ReconnectingClientFactory): | |
protocol = AnnuskaIRC | |
channels = irc_settings['channels'] | |
if __name__ == '__main__': | |
reactor.connectTCP(irc_settings['server'], irc_settings['port'], AnnuskaIRCactory()) | |
log.startLogging(sys.stdout) | |
reactor.run() | |
elif __name__ == '__builtin__': | |
application = service.Application('AnnuskaIRCBot') | |
ircService = internet.TCPClient(irc_settings['server'], irc_settings['port'], AnnuskaIRCactory()) | |
ircService.setServiceParent(application) | |
moose:Annuska richard$ python annuska.py | |
Traceback (most recent call last): | |
File "annuska.py", line 272, in <module> | |
reactor.connectTCP(irc_settings['server'], irc_settings['port'], AnnuskaIRCactory()) | |
File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/posixbase.py", line 425, in connectTCP | |
c = tcp.Connector(host, port, factory, timeout, bindAddress, self) | |
File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/tcp.py", line 1019, in __init__ | |
raise error.ServiceNameUnknownError(string="%s (%r)" % (e, port)) | |
twisted.internet.error.ServiceNameUnknownError: Service name given as port is unknown: service/proto not found ('6667'). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The real problem is port. It needs an integer, not a string. ;)