[Tutor] AttributeError - ChatServer

John Fouhy john at fouhy.net
Fri Jan 27 03:02:54 CET 2006


On 27/01/06, Bob Hinkle <hinkle.bob at gmail.com> wrote:
> While following a tutorial on how to create a simple chat server I stumbled
> upon this problem:
>  AttributeError: ChatServer instance has no attribute 'decriptors'

Hi Bob,

Attributes are things like methods or variables that are "attached" to
a class instance.  For example, instances of your CharServer class
have attributes like .port or .srvsock.

When you get an AttributeError, it means that you tried to access an
attribute and python couldn't find the attribute you wanted.  In this
particular case, the error message says that on line 53, you tried to
access "self.decriptors", and "self" (which is your ChatServer) didn't
have a "decriptors" attribute.

Looking through your code, I can see that you assign to
"self.descriptors" in your __init__ method.  So I guess this is just a
typo --- if you change "self.decriptors" to "self.descriptors", you
might have more luck :-)

--
John.


More information about the Tutor mailing list