AttributeError: 'list' object has no attribute 'lower'

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Sep 10 05:52:34 EDT 2012


Token Type wrote:
>> In fact, I'm guessing that's your problem.  I think you're ending up 
>>
>> with a list of lists of strings, when you think you're getting a list of 
>>
>> strings.
>>
>>     
> Thanks. You guess right. It turns out that lemma_list is a list of list, as I tested in the previous post.
>   

I often noticed people around me that are not that familiar with python 
are dismissing the error stack so quickly ; they probably knows the 
machine is trying to communicate with them but they don't seem to 
understand the message. Error stacks may be difficult to read at first 
glance but you can solve a lot of problems just by reading it.

So next time you see 'X' has no attribute 'Y', you'll know that you've 
accessed an attribute/method of an object that does not exist, either 
you made a typo in the attribute name, or you object is not actually 
what you think it is.

Advice : if you have so time, install ipython and execute your scripts 
in an ipython shell with the %pdb faeture on. This will automatically 
call the debugger upon unhandled exceptions and you'll be able to 
inspect your objects live from the prompt.

JM









More information about the Python-list mailing list