jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 87 forks source link

ssl-cat.py fails to run #31

Closed jaraco closed 8 years ago

jaraco commented 8 years ago

Running scripts/ssl-cat.py with valid arguments causes a TypeError exception.

This is with python 2.6 (running on RedHat Enterprise 6).

For example:

$ python ssl-cat.py -p 7000 example.com foobot somechannel

Traceback (most recent call last): File "ssl-cat.py", line 76, in main() File "ssl-cat.py", line 63, in main connect_factory=ssl_factory, File "/usr/lib/python2.6/site-packages/irc/functools.py", line 35, in wrapper return method(self, _args, *_kwargs) File "/usr/lib/python2.6/site-packages/irc/client.py", line 488, in connect self.socket = self.connect_factory(self.server_address) File "/usr/lib/python2.6/site-packages/irc/connection.py", line 60, in connect sock.bind(self.bind_address) File "", line 1, in bind TypeError: getsockaddrarg: AF_INET address must be tuple, not function


jaraco commented 8 years ago

Confirmed on python 2.7 with identical traceback.

Actually, the library is ok, it's that ssl-cat.py doesn't call irc.connection.Factory the right way.

scripts/ssl-cat.py line 56 calls

#!python

    ssl_factory = irc.connection.Factory(ssl.wrap_socket)

when it should be

#!python

    ssl_factory = irc.connection.Factory(wrapper=ssl.wrap_socket)

resulting in the wrapper being assigned to the bind_address


Made a pull request with the fix https://bitbucket.org/jaraco/irc/pull-request/22/fix-factory-call-in-ssl-example-script/diff

Too bad it's only a one-liner :)


Original comment by: Nick Raptis

jaraco commented 8 years ago

Thanks Nick for the fix.


Original comment by: Jason R. Coombs