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

Chris Mellon arkanes at gmail.com
Thu Mar 13 11:47:18 EDT 2008


On Thu, Mar 13, 2008 at 10:36 AM, Robert Rawlins
<robert.rawlins at thinkbluemedia.co.uk> wrote:
>
>
>
>
> 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.
>

Create a copy of your source file, confirm that it shows the problem,
and start chopping out lines until all that is left is what you pasted
here. See if it still shows the problem. If it does, and if you
haven't found the problem yet, post again, attaching (not pasting
inline) your chopped down file.



More information about the Python-list mailing list