Twisted/wxPython Problem...

Diez B. Roggisch deets at nospam.web.de
Mon Apr 24 10:40:39 EDT 2006


PeterG wrote:

> Hi,
> 
> I am relatively new to Python, and am learning it as part of a
> university
> module...
> 
> Im currently undertaking a project to create an IM server and IM gui
> client.
> 
> I have a very basic server, and a basic gui client.  I can get my
> client to
> connect to my server, but cant get it to disconnect or send messages to
> the
> server.
> 
> I am getting the following error when I click on the 'Disconnect'
> button -
> AttributeError: 'NoneType' object has no attribute 'loseConnection'

It seems that your client inherits from two classes, but doesn't invoke
their respective constructors. That makes python only call the first
classes constructor, as this simple experiment shows:

class A(object):
    def __init__(self):
        print "I'm A"

class B(object):
    def __init__(self):
        print "I'm B"


class C(A,B):
    pass



C()


 -> I'm A


so - create a constructor, invoke both constructors of your super-classes
either explicitly or using super (make sure you understand super!)


Regards,

Diez



More information about the Python-list mailing list