"Attribute Doesnt Exist" ... but.... it does :-s

Robert Rawlins robert.rawlins at thinkbluemedia.co.uk
Thu Mar 13 11:36:49 EDT 2008


Hello Guys,

 

I've got an awfully aggravating problem which is causing some substantial
hair loss this afternoon J I want to get your ideas on this. I am trying to
invoke a particular method in one of my classes, and I'm getting a runtime
error which is telling me the attribute does not exist.

 

I'm calling the method from within __init__ yet it still seems to think it
doesn't exist.

 

Code:

 

# Define the RemoteDevice class.

class remote_device:

    

    # I'm the class constructor method.

    def __init__(self, message_list=""):

        self.set_pending_list(message_list)

    

    def set_pending_list(self, pending_list):

            # Set the message list property.

            self.pending_list = message_list

 

And the error message which I receive during the instantiation of the class:

 

File: "/path/to/my/files/remote_device.py", line 22, in __init__

    self.set_pending_list(message_list)

AttributeError: remote_device instance has no attribute 'set_pending_list'

 

Does anyone have the slightest idea why this might be happening? I can see
that the code DOES have that method in it, I also know that I don't get any
compile time errors so that should be fine. I know it mentions line 22 in
the error, but I've chopped out a load of non relevant code for the sake of
posting here.

 

Perhaps I'm missing something really simple, but it's got my head spinning.

 

Thanks,

 

Robert

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080313/5b25bd21/attachment.html>


More information about the Python-list mailing list