Message bug?

A.M. Kuchling akuchlin at ute.mems-exchange.org
Wed Mar 20 11:24:35 EST 2002


In article <99dh9us1b4d8r9u7p5ltt41g34vlun4kjj at 4ax.com>, Dale Strickland-Clark wrote:
> AttributeError: 'module' object has no attribute 'work'
> 
> I have no module called 'module'. 

It's printing the type of the offending object:

>>> a.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'int' object has no attribute 'foo'
>>>

I suppose the single quotes are a bit confusing; maybe they should
just be removed.  Classes do better:

>>> class C: pass
...
>>> c=C()
>>> c.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: C instance has no attribute 'foo'

Reasonable.  But new-style classes bring the single quotes back:

>>> class D(object): pass
...
>>> d=D()
>>> d.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'D' object has no attribute 'foo'
>>>

--amk



More information about the Python-list mailing list