python-irclib and threading

Robin Krahl me at
Tue Oct 12 16:50:09 CEST 2010

Hi folks,

I’m writing a program with a component that has to connect to IRC and
call a callback function in case of a message.  I tried using
python-irclib for doing this, and executing the code in the main thread
worked fine.  When I moved the code part into the run method of a
threading.Thread class, it doesn’t work anymore.  The code is:

# …
    def run(self):
        # …
        irc = irclib.IRC()
        server = irc.server()
        server.connect('', 6667, 'rcc')
        # …
# …

(self._lg = logging.getLogger(…))

Now, the connect method does not return.  That means that ‘AAA’ is
logged while ‘BBB’ and ‘CCC’ are not displayed (yes, I waited long

My guess was that the problem is that I have to call the connect()
method from the main thread.  Is this right?  If yes, what can I do
about it?  If no, do you have an idea what’s the problem?

Best regards,

Robin Krahl || ireas
  me at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 286 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Python-list mailing list