irclib problems

Tina I tinaweb at bestemselv.com
Sun Feb 11 03:29:09 EST 2007


I'm playing around with the 'irclib' library working with the first 
example at 
http://www.devshed.com/c/a/Python/IRC-on-a-Higher-Level-Concluded/

When copying the example verbatim and running it from a console it works 
flawlessly. It connects to the server, join the channel and sits there 
'forever'...

However, I want to use it in a PyQt application and have done the following.
I have created a module named 'irclibtest.py' that looks like this:

### irclibtest start ###
import irclib
irclib.DEBUG = True

class Conn:
     def __init__(self):
         # Network information
         self.network = '192.x.x.x'
         self.port = 6667
         self.channel = '#test'
         self.nick = 'IRClibt'
         self.name = 'Python Test'

         # Subclass SimpleIRCClient
         class ClientClass ( irclib.SimpleIRCClient ):
             pass

         # Create an instance of ClientClass and connect.
         self.client = ClientClass()
         self.client.connect ( self.network, self.port, self.nick, 
ircname = self.name )
         self.client.connection.join ( self.channel )
##irclibtest end ###

And my main Qt application:

### Main application start ###
#!/usr/bin/python
# -*- coding: utf-8 -*-


import sys, irclib
from PyQt4 import QtGui , QtCore
from tircUI import Ui_MainWindow
from irclibtest import Conn

class TircMain(QtGui.QMainWindow , Conn):
     def __init__(self):
         QtGui.QMainWindow.__init__(self )
         Conn.__init__(self)
         self.ui = Ui_MainWindow()
         self.ui.setupUi(self)

         self.connect(self.ui.sendButton, QtCore.SIGNAL("clicked()"), 
self.doSend)

     def doSend(self):
         ''' Just a test to see if I can send to channel'''
         self.client.connection.privmsg('#test' , 'Test text')

if __name__ == "__main__":
     app = QtGui.QApplication(sys.argv)
     f = TircMain()
     f.show()
     sys.exit(app.exec_())
### Main application end ##

The problem is that this pings out (PING timeout). As far as I 
understand it rclib.SimpleIRCClient is supposed to handle PING-PONG with 
the server so I don't understand why it does not in my Qt test, but it 
does 'raw'.
I can send to the channel right up to the point it times out by the way.

Anyone know what I'm missing here?

Thanks
Tina



More information about the Python-list mailing list