Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28810

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

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=593f3b39c=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attribute': 0.05; 'exist,': 0.07; 'strings.': 0.07; "subject:' ": 0.07; 'scripts': 0.09; 'python': 0.09; 'debugger': 0.09; 'unhandled': 0.09; 'cc:addr:python-list': 0.10; 'stack': 0.15; 'guessing': 0.16; 'subject:object': 0.16; 'typo': 0.16; 'wrote:': 0.17; 'shell': 0.18; 'trying': 0.21; 'thanks.': 0.21; 'exceptions': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'machine': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'guess': 0.27; 'right.': 0.27; 'subject:list': 0.28; 'noticed': 0.28; 'inspect': 0.29; 'strings,': 0.29; 'objects': 0.29; 'probably': 0.29; "i'm": 0.29; 'install': 0.29; 'knows': 0.30; 'error': 0.30; 'lists': 0.31; 'problem.': 0.32; 'quickly': 0.32; 'getting': 0.33; 'message.': 0.33; 'turns': 0.33; 'list': 0.35; 'next': 0.35; 'but': 0.36; 'problems': 0.36; 'execute': 0.37; 'does': 0.37; 'communicate': 0.37; 'previous': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'advice': 0.39; 'list,': 0.39; 'think': 0.40; 'your': 0.60; "you've": 0.61; 'received:194': 0.61; 'first': 0.61; "you'll": 0.62; 'time,': 0.62; 'is.': 0.62; 'solve': 0.62; 'fact,': 0.69; 'subject:skip:A 10': 0.75; 'glance': 0.91
X-IronPort-AV E=Sophos;i="4.80,397,1344204000"; d="scan'208";a="712455"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Mon, 10 Sep 2012 11:52:34 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
User-Agent Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
MIME-Version 1.0
To Token Type <typetoken@gmail.com>
Subject Re: AttributeError: 'list' object has no attribute 'lower'
References <df7ab5f7-c273-4a62-b79a-f364f9c2d3b0@googlegroups.com> <roy-838395.13453908092012@news.panix.com> <113e44c3-cd53-4536-a60c-0363bf83a8ec@googlegroups.com>
In-Reply-To <113e44c3-cd53-4536-a60c-0363bf83a8ec@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.440.1347270755.27098.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347270755 news.xs4all.nl 6913 [2001:888:2000:d::a6]:33722
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28810

Show key headers only | View raw


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





Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-08 10:13 -0700
  wordnet NLTK Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-08 10:32 -0700
  Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-08 13:45 -0400
    Re: AttributeError: 'list' object has no attribute 'lower' Cameron Simpson <cs@zip.com.au> - 2012-09-09 09:26 +1000
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 06:50 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-09 10:29 -0400
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 07:00 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-10 11:52 +0200
        Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-14 08:01 -0700
          Re: AttributeError: 'list' object has no attribute 'lower' Chris Angelico <rosuav@gmail.com> - 2012-09-15 01:19 +1000
        Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-14 08:01 -0700
          Re: AttributeError: 'list' object has no attribute 'lower' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-14 15:18 +0000
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 07:19 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-09 10:32 -0400

csiph-web