f

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

On page 77 of the book natural language processing with Python, we have such an exercise: The polysemy of a word is the number of senses it has. Using WordNet, we can determine that the noun doghas seven senses with len(wn.synsets('dog', 'n')).

I wrote the following function to solve it. However, it pops up "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I supposed [synset.lemma_names for synset in synset_list] has made all the lemma into a list, hasn't it?

>>> def average_polysemy(pos):
synset_list = list(wn.all_synsets(pos))
lemma_list = [synset.lemma_names for synset in synset_list]
sense_number = 0
for lemma in lemma_list:
sense_number_new = len(wn.synsets(lemma, pos))
sense_number = sense_number + sense_number_new
return sense_number/len(synset_list)

>>> average_polysemy('n')

Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
average_polysemy('n')
File "<pyshell#53>", line 6, in average_polysemy
sense_number_new = len(wn.synsets(lemma, pos))
File "C:\Python27\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1191, in synsets
lemma = lemma.lower()
AttributeError: 'list' object has no attribute 'lower'


 0
typetoken (19)
9/8/2012 5:13:21 PM
comp.lang.python 77058 articles. 6 followers.

12 Replies
6837 Views

Similar Articles

[PageSpeed] 19

I don't know why lemma_list = [synset.lemma_names for synset in synset_list] will lead to such an error.

I have to use extend to solve the problem for lemma_list. The following codes are successful, take all the nouns as an example:

>>> def average_polysemy(pos):
synset_list = list(wn.all_synsets(pos))
sense_number = 0
lemma_list = []
for synset in synset_list:
lemma_list.extend(synset.lemma_names)
for lemma in lemma_list:
sense_number_new = len(wn.synsets(lemma, pos))
sense_number = sense_number + sense_number_new
return sense_number/len(synset_list)

>>> average_polysemy('n')
3

>
> I wrote the following function to solve it. However, it pops up "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I supposed [synset.lemma_names for synset in synset_list] has made all the lemma into a list, hasn't it?
>
>
>
> >>> def average_polysemy(pos):
>
> 	synset_list = list(wn.all_synsets(pos))
>
> 	lemma_list = [synset.lemma_names for synset in synset_list]
>
> 	sense_number = 0
>
> 	for lemma in lemma_list:
>
> 		sense_number_new = len(wn.synsets(lemma, pos))
>
> 		sense_number = sense_number + sense_number_new
>
> 	return sense_number/len(synset_list)
>
>
>
> >>> average_polysemy('n')
>
>
>
> Traceback (most recent call last):
>
>   File "<pyshell#54>", line 1, in <module>
>
>     average_polysemy('n')
>
>   File "<pyshell#53>", line 6, in average_polysemy
>
>     sense_number_new = len(wn.synsets(lemma, pos))
>
>   File "C:\Python27\lib\site-packages\nltk\corpus\reader\wordnet.py", line 1191, in synsets
>
>     lemma = lemma.lower()
>
> AttributeError: 'list' object has no attribute 'lower'
>
>
>

 0
typetoken (19)
9/8/2012 5:32:59 PM
In article <df7ab5f7-c273-4a62-b79a-f364f9c2d3b0@googlegroups.com>,
Token Type <typetoken@gmail.com> wrote:

> I wrote the following function to solve it. However, it pops up
> "AttributeError: 'list' object has no attribute 'lower'". Quite confused, I
> supposed [synset.lemma_names for synset in synset_list] has made all the
> lemma into a list, hasn't it?

I'm not familiar with that library, but here's a few general ideas to

First, I don't understand this code:

> 	synset_list = list(wn.all_synsets(pos))
> 	lemma_list = [synset.lemma_names for synset in synset_list]

It looks like you're taking an iterable, converting it to a list, just
so you can iterate over it again.  Why not the simpler:

> lemma_list = [synset.lemma_names for synset in wn.all_synsets(pos)]

?  But, I'm also confused about what lemma_list is supposed to end up
being.  The name "lemma_names" is plural, making me think it returns a
list of something.  And then you build those up into a list of lists?

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.

My suggestion is to print out all the intermediate data structures
(synset_list, lemma_list, etc) and see what they look like.  If the
structures are simple, just plain print will work, but for more
complicated structures, pprint.pprint() is a life saver.

Another possibility is to assert that things are what you expect them to
be.  Something like:

assert isinstance(synset_list, list)
assert isinstance(lemma_list, list)
assert isinstance(lemma_list[0], str)

and so on.

> 	for lemma in lemma_list:
> 		sense_number_new = len(wn.synsets(lemma, pos))
> 		sense_number = sense_number + sense_number_new
> 	return sense_number/len(synset_list)
>
> >>> average_polysemy('n')
>
> Traceback (most recent call last):
>   File "<pyshell#54>", line 1, in <module>
>     average_polysemy('n')
>   File "<pyshell#53>", line 6, in average_polysemy
>     sense_number_new = len(wn.synsets(lemma, pos))
>   1191, in synsets
>     lemma = lemma.lower()
> AttributeError: 'list' object has no attribute 'lower'
>

 0
roy (2295)
9/8/2012 5:45:39 PM
Thanks very much for all of your tips. Take noun as an example. First, I ne=
ed find all the lemma_names in all the synsets whose pos is 'n'. Second, fo=
r each lemma_name, I will check all their sense number.=20

1)  Surely,we can know the number of synset whose pos is noun by=20
>>> len([synset for synset in wn.all_synsets('n')])
82115

However, confusingly it is unsuccessful to get a list of lemma names of the=
se synsets by=20
>>> lemma_list =3D [synset.lemma_names for synset in wn.all_synsets('n')]
>>> lemma_list[:20]
[['entity'], ['physical_entity'], ['abstraction', 'abstract_entity'], ['thi=
ng'], ['object', 'physical_object'], ['whole', 'unit'], ['congener'], ['liv=
ing_thing', 'animate_thing'], ['organism', 'being'], ['benthos'], ['dwarf']=
, ['heterotroph'], ['parent'], ['life'], ['biont'], ['cell'], ['causal_agen=
t', 'cause', 'causal_agency'], ['person', 'individual', 'someone', 'somebod=
y', 'mortal', 'soul'], ['animal', 'animate_being', 'beast', 'brute', 'creat=
ure', 'fauna'], ['plant', 'flora', 'plant_life']]
>>> type(lemma_list)
<type 'list'>

Though the lemma_list is a list in the above codes, it contains so many unn=
ecessary [ and ]. How come it is like this? But what we desire and expect i=
s a list without this brackets. Confused, I am really curious to know why.

2)  Then I have to use a loop and extend to get all the lemma_names from sy=
nset:
>>> synset_list =3D list(wn.all_synsets('n'))
>>> lemma_list =3D []
>>> for synset in synset_list:
lemma_list.extend(synset.lemma_names)
>>> lemma_list[:20]
['entity', 'physical_entity', 'abstraction', 'abstract_entity', 'thing', 'o=
bject', 'physical_object', 'whole', 'unit', 'congener', 'living_thing', 'an=
imate_thing', 'organism', 'being', 'benthos', 'dwarf', 'heterotroph', 'pare=
nt', 'life', 'biont']

3) In this case, I have to use loop to get all the lemma_names instead of [=
synset.lemma_names for synset in wn.all_synsets('n')]. The following is a w=
orking solution:

>>> def average_polysemy(pos):
synset_list =3D list(wn.all_synsets(pos))
sense_number =3D 0
lemma_list =3D []
for synset in synset_list:
lemma_list.extend(synset.lemma_names)
for lemma in lemma_list:
sense_number_new =3D len(wn.synsets(lemma, pos))
sense_number =3D sense_number + sense_number_new
return sense_number/len(synset_list)

>>> average_polysemy('n')
3

Thanks again.

 0
typetoken (19)
9/9/2012 1:50:16 PM
> 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.

 0
typetoken (19)
9/9/2012 2:00:34 PM
> structures are simple, just plain print will work, but for more
>
> complicated structures, pprint.pprint() is a life saver.
>

I did try . However,

>>> pprint.pprint(lemma_list)

Traceback (most recent call last):
File "<pyshell#74>", line 1, in <module>
pprint.pprint(lemma_list)
NameError: name 'pprint' is not defined
>>> pprint.pprint(synset_list)

Traceback (most recent call last):
File "<pyshell#75>", line 1, in <module>
pprint.pprint(synset_list)
NameError: name 'pprint' is not defined
>>>

 0
typetoken (19)
9/9/2012 2:19:42 PM
In article <43a68990-d6cf-4362-8c47-b13ce780b068@googlegroups.com>,
Token Type <typetoken@gmail.com> wrote:

> Thanks very much for all of your tips. Take noun as an example. First, I need
> find all the lemma_names in all the synsets whose pos is 'n'. Second, for
> each lemma_name, I will check all their sense number.
>
> 1)  Surely,we can know the number of synset whose pos is noun by
> >>> len([synset for synset in wn.all_synsets('n')])
> 82115
>
> However, confusingly it is unsuccessful to get a list of lemma names of these
> synsets by
> >>> lemma_list = [synset.lemma_names for synset in wn.all_synsets('n')]
> >>> lemma_list[:20]
> [['entity'], ['physical_entity'], ['abstraction', 'abstract_entity'],
> ['thing'], ['object', 'physical_object'], ['whole', 'unit'], ['congener'],
> ['living_thing', 'animate_thing'], ['organism', 'being'], ['benthos'],
> ['dwarf'], ['heterotroph'], ['parent'], ['life'], ['biont'], ['cell'],
> ['causal_agent', 'cause', 'causal_agency'], ['person', 'individual',
> 'someone', 'somebody', 'mortal', 'soul'], ['animal', 'animate_being',
> 'beast', 'brute', 'creature', 'fauna'], ['plant', 'flora', 'plant_life']]
> >>> type(lemma_list)
> <type 'list'>
>

> Though the lemma_list is a list in the above codes, it contains so many
> unnecessary [ and ]. How come it is like this? But what we desire and expect
> is a list without this brackets. Confused, I am really curious to know why.

It looks like synset.lemma_names gets you a list.  And then you're
taking all those lists and forming them into a list of lists:

>>> lemma_list = [synset.lemma_names for synset in wn.all_synsets('n')]

I think what you want to study is the difference between list.append()
and list.extend().  When you use the list builder syntax, you're
essentially writing a loop which does append operations.  The above is
the same as if you wrote:

lemma_list = list()
for synset in wn.all_synsets('n'):
lemma_list.append(synset.lemma_names)

and I think what you're looking for is:

lemma_list = list()
for synset in wn.all_synsets('n'):
lemma_list.extend(synset.lemma_names)

 0
roy (2295)
9/9/2012 2:29:11 PM
In article <dea2fdd1-ad19-4254-b3bf-4104ce0cb241@googlegroups.com>,
Token Type <typetoken@gmail.com> wrote:

> > structures are simple, just plain print will work, but for more
> >
> > complicated structures, pprint.pprint() is a life saver.
> >
>
> I did try . However,
>
> >>> pprint.pprint(lemma_list)
>
> Traceback (most recent call last):
>   File "<pyshell#74>", line 1, in <module>
>     pprint.pprint(lemma_list)
> NameError: name 'pprint' is not defined
> >>> pprint.pprint(synset_list)
>
> Traceback (most recent call last):
>   File "<pyshell#75>", line 1, in <module>
>     pprint.pprint(synset_list)
> NameError: name 'pprint' is not defined
> >>>

OK, I can see how this can be confusing.  In "pprint.pprint()", the two
"pprint"s mean different things.  The first one is the name of a module.
The second one is the name of a function in that module.  In general, I
dislike this style of naming since it just leads to this kind of
confusion.

In any case, you need to do one of two things.

Style 1:

import pprint
pprint.pprint(foo)

Style 2:

from pprint import pprint
pprint(foo)

 0
roy (2295)
9/9/2012 2:32:33 PM
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


 0
jeanmichel (487)
9/10/2012 9:52:34 AM
Thanks. By the way, do we have a list of explanations of error message? If so, whenever we come across error message, we can refer to it and solve the problem accordingly.

 0
typetoken (19)
9/14/2012 3:01:11 PM
Thanks. By the way, do we have a list of explanations of error message? If so, whenever we come across error message, we can refer to it and solve the problem accordingly.

 0
typetoken (19)
9/14/2012 3:01:11 PM
On Fri, 14 Sep 2012 08:01:11 -0700, Token Type wrote:

> Thanks. By the way, do we have a list of explanations of error message?
> If so, whenever we come across error message, we can refer to it and
> solve the problem accordingly.

Forget about a "list of explanations of error message[s]". There is no
such list, and there never will be, because there is no limit to the
number and kind of possible error messages.

Instead, you should actually read the error message you see. Python is
telling you what the problem is. Pay attention to it.

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

This tells you that you tried to access something.lower, but "something"
is a list, and lists don't have an attribute or method "lower".

Normally, Python will show you the line of source code with the error, so
you will even see the name of the variable.

--
Steven

 0
9/14/2012 3:18:27 PM
On Sat, Sep 15, 2012 at 1:01 AM, Token Type <typetoken@gmail.com> wrote:
> Thanks. By the way, do we have a list of explanations of error message? If so, whenever we come across error message, we can refer to it and solve the problem accordingly.

Not really, but if you paste the message into Google or DuckDuckGo or
another web search engine, you'll usually find something helpful.
Possibly add a few keywords about what you're doing, if the message
alone is too general.

By the way, you don't need to include both comp.lang.python and
one will make it arrive on the other too.

Have fun!

ChrisA

 0
rosuav (4324)
9/14/2012 3:19:24 PM

Similar Artilces:

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

'is not' or '!='
A newbie question to you; what is the difference between statements like: if x is not None: and if x != None: Without any context, which one should be preferred? IMHO, the latter is more readable. On 2014-08-18 21:35, ElChino wrote: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: > > Without any context, which one should be preferred? > IMHO, the latter is more readable. > "x == y" tells you whether x and y refer to objects that are equal. "x is y" tells you whether x and y actually refer to the same object. In the case of singletons like None (there's only one None object), it's better to use "is". "ElChino" <elchino@cnn.cn>: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: Do the following: take two $10 bills. Hold one bill in the left hand, hold the other bill in the right hand. Now, the bill in the left hand "is not" the bill in the right hand. However, the bill in the left hand "==" the bill in the right hand. > Without any context, which one should be preferred? > IMHO, the latter is more readable. In almost all cases, both tests would result in the same behavior. However, the "is not" test is conceptually the correct one since you want... AttributeError: 'Attributes' object has no attribute 'saveFile' Not sure how to explain, but I'll try my best. I'm making a GUI with wxGlade. The GUI has windows that open when the "Next Page" button is pushed; the button also pickles the information that is input into the frame at the same time. The saveFile name is autocreated based on the data entered by the user in the first frame. Each frame that is created is a new class, e.g. the first frame that opens is "CharInfo", which opens the frame "Attributes". The pickling works for the first frame but doesn't work for the ones after. Apparently the saveFile at... AttributeError: 'Or' object has no attribute 'as_independent' Traceback (most recent call last): File "testcsv.py", line 17, in <module> print(sy.solve([x^2+x+1-t, x^3+x^2-t], x)) File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 902, in so lve solution = _solve_system(f, symbols, **flags) File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 1434, in _ solve_system i, d = _invert(g, *symbols) File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 2422, in _ invert indep, dep = lhs.as_independent(*symbols) AttributeError: 'Or' object has no attribute 'as_independent' Code: import csv as csv import os import numpy as np import sympy as sy #from sympy import solve, Poly, Eq, Function, exp from sympy import * from numpy import * from numpy.linalg import * from sympy.polys.polyfuncs import interpolate from sympy import Function, dsolve, Eq, Derivative, sin, cos from sympy.abc import x f = sy.Function('f') x = sy.Symbol("x") t = sy.Symbol("t") print(sy.solve([x^2+x+1-t, x^3+x^2-t], x)) print(sy.solve((x^2+x+1-t, x^3+x^2-t), x)) On 2/13/2014 4:03 AM, wilsonmonde@gmail.com wrote: > Traceback (most recent call last): > File "testcsv.py", line 17, in <module> > print(sy.solve([x^2+x+1-t, x^3+x^2-t], x)) > File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 902, in so > lve ... PyKota, Python: AttributeError: 'module' object has no attribute '_quote' Hello everyone, I'm new to linux/suse, but I was given the task to install the print accounting software PyKota. Before that I never even touched a linux system, so I don't have any basic knowlegde at all! Up to now I was able to solve all problems with the help of google, but now I'm stuck. My problem: linux-6n5c:/usr/local/bin # pkusers --add john paul Creation... ERROR: PyKota v1.26_official ERROR: pkusers failed ERROR: Traceback (most recent call last): ERROR: File "/usr/local/bin/pkusers", line 442, in <module> ERROR: retco... AttributeError: 'module' object has no attribute '__path__' I am using Jupyter notebooks, with Python 3.4. The error below references t= he Anaconda distribution package. This error occurred quite precipitously (= only 2 minutes before I was able to import the modules). I am using Windows= 7. My path in the console uses Python27. I also have python 34 as well. I = am not sure where to start modifying the path and fear that I will break my= initial setup. I welcome feedback on next steps. --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) ... AttributeError: 'tuple' object has no attribute 'encode' Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data[parent][child]['results']['test']) It raises this error: AttributeError: 'tuple' object has no attribute 'encode' Some of the variables are unicode (test and ag) - is that what is causing this error? What do I need to do to make it work? Thanks! Erik On Apr 5, 10:31 am, "erikcw" <erikwickst...@gmail.com> wrote: > Hi, > > I'm trying to build a SQ... AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback' ------=_Part_1122770_31157900.1360876583037 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit I am using ubuntu 12.10 and python version 2.7.3. i run the following command in terminal: matt@matt-Inspiron-1525:~$ python -m trace --count -C . op25_grc.py Here is the output with an error: Imported legacy fsk4 Using Volk machine: ssse3_32 Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib/python2.7/trace.py", line 819, in <module> main() File "/usr/lib/python2.7/trace.py", line 807, in main t.runctx(code, globs, globs) File "/usr/lib/python2.7/trace.py", line 513, in runctx exec cmd in globals, locals File "op25_grc.py", line 493, in <module> tb = op25_grc() File "op25_grc.py", line 231, in __init__ self.wxgui_fftsink2_0_0.set_callback(wxgui_fftsink2_0_0_callback) File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py", line 54, in __getattr__ return getattr(self._hb, name) AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback' here is the code for "hier_block2_.py": # Copyright 2006,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radi...

AttributeError: 'module' object has no attribute 'urlopen'
Hey, I am trying to run the following example from diveintopython import urllib sock = urllib.urlopen("http://diveintopython.org/") htmlSource = sock.read() sock.close() print htmlSource I have Python 2.3.3 but when i run the above code I get the following error: raceback (most recent call last): File "urllib.py", line 1, in ? import urllib File "/home/shalen/programming/python/tutorials/py/urllib.py", line 2, in ? sock = urllib.urlopen("http://diveintopython.org/") AttributeError: 'module' object has no attribute 'urlopen' Anyone knows how to fix this and why I am getting this error? Thanks Dont ~ ~ ~ ~ __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools dont bother wrote: > import urllib > sock = urllib.urlopen("http://diveintopython.org/") > htmlSource = sock.read() > sock.close() > print htmlSource > > I have Python 2.3.3 but when i run the above code I > get the following error: > > raceback (most recent call last): > File "urllib.py", line 1, in ? > import urllib > File > "/home/shalen/programming/python/tutorials/py/urllib.py", > line 2, in ? > sock = > urllib.urlopen("http://diveintopython.org/") > AttributeError: 'module' object has no attribute > 'urlopen' > This is a name cl...

AttributeError: 'module' object has no attribute 'pack'
Dear List, I have a freshly installed opensuse 11.2 and I am experiencing the following problem with the module "subprocess": sampsa@linux-912g:~> python Python 2.6 (r26:66714, Feb 3 2009, 20:52:03) [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/subprocess.py", line 404, in <module> import p...

AttributeError: 'module' object has no attribute 'setdefaulttimeout'
I get those errors when I run: /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf ################## Traceback (most recent call last): File "/usr/local/bin/SquidClamAV_Redirector.py", line 573, in ? redirector = SquidClamAV_Redirector(config) File "/usr/local/bin/SquidClamAV_Redirector.py", line 145, in __init__ self.__start_urlhandler__() File "/usr/local/bin/SquidClamAV_Redirector.py", line 454, in __start_urlhandler__ urllib.socket.setdefaulttimeout(self.timeout) AttributeError: 'module' object has no attribute 'setdefaulttimeout' ################# the line that is the problem looks like this: ############# urllib.socket.setdefaulttimeout(self.timeout) ############# from the global sintax: ############## def __start_urlhandler__(self): """ create the urlhandler object """ # set timeout urllib.socket.setdefaulttimeout(self.timeout) self.urlhandler = urllib.URLopener() if self.proxy != {}: self.urlhandler.proxies = self.proxy self.urlhandler.addheaders = [('User-agent', ModuleName + ' ' + str(version))] ############## can you give me a hint with this matter? adrian wrote: > urllib.socket.setdefaulttimeout(self.timeout) > AttributeError: 'module' object has no attribute 'setdef...

AttributeError: 'module' object has no attribute 'letters'
what does this error mean? i am trying to use mark hammonds win32 package. Traceback (most recent call last): File "aui2.py", line 11, in <module> import win32com.client File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 12, in <module> import dynamic, gencache, pythoncom File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line 24, in <module> import build File "C:\Python25\lib\site-packages\win32com\client\build.py", line 507, in <module> valid_identifier_chars = string.le...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal'''''''''''''' #2

if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ?
Hi, there. =20 I'm just curious if it ever dawned on anybody how to abbreviate this line : if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.')=20 =20 Igor Kurbeko Clinical Programmer Analyst 678 336 4328 ikurbeko@atherogenics.com =20 no brain no pain =20 how about: if not (str_mo in ('','.') or str_da in ('','.') or str_yy in ('','.')) OR if not (missing(str_mo) or missing(str_da) or missing(str_yy)) Eric On 22 Oct 03 21:13:37 GMT, ikurbeko@ATHER...

M2Crypto: AttributeError: 'CSR' object has no attribute 'pkey'
Hello python-guys I am trying to build a python based certificate authority using m2crypto. I am quite new to python and I am asking myself why my code snippets below throw the following Traceback: $python csr.py ....++++++++++++ ................++++++++++++ Traceback (most recent call last): File "csr.py", line 48, in <module> csr.create_cert_signing_request(pubkey, cert_name) File "csr.py", line 17, in create_cert_signing_request cert_request.set_pubkey(keypair) File "/usr/lib64/python2.6/site-packages/M2Crypto/X509.py", line 926, in set_... A function with 'and' , 'not' , 'null' , 'car' and 'cdr' What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ... AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)$ ~/devel/ice/snoip/freespeech$python Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import logging >>> logging.DatagramHandler Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'DatagramHandler' >>> That is odd since the documentation says there is DatagramHandler for module logging On Mon, Dec 29, 2008 at 4:08 AM, Tz... When I do from lxml import etree I've this error : AttributeError: 'module' object has no attribute 'BytesIO' Hi, I'm on Ubuntu 8.04.1 I've installed lxml with easy_install lxml command. Now, when I load etree I've this error :$ python Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import etree Traceback (most recent call last): File "<stdin>", line 1, in <module> File "lxml.etree.pyx", line 40, in lxml.etree (src/lxml/ lxml.etree.c:119415) AttributeError: 'module&#...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ##...

Override 'and' and 'or'
Is it possible to override 'and' and/or 'or'? I cannot find a special method for it... __and__ and __rand__ and __or__ and __ror__ are for binary manipulation... any proposals? Have marvelous sunday, Marco Dekker <m.aschwanden@gmail.com> wrote: > Is it possible to override 'and' and/or 'or'? I cannot find a special > method for it... __and__ and __rand__ and __or__ and __ror__ are for > binary manipulation... any proposals? If you want to customize the truth value testing you have to implement __nonzero__ " __nonzero__( self) Call...

logical to 'on' / 'off'
Hi, is there a function implemented doing this conversion? my Problem is, that I want to use the following code: set(handles.edit_curr_trq_sl,'Enable',get(hObject,'Value')) where get(hObject,'Value') gives the state of a checkbox thank you! function [str]=tf2oo(logic) switch logic case 0 str='off'; case 1 str='on'; end%switch end%function tf2oo() while i do not know a built in function, I use my own:) meisterbartsch wrote: > > > function [str]=tf2oo(logic) > switch logic > case 0 > str='off'; &g...

'a'..'z'
Is it possible to achieve something like this? switch (mystring.charAt(0)) { case 'a'..'z': // do something break; } "cruster" <cruster@gmail.com> wrote in message news:1151319731.988814.326200@m73g2000cwd.googlegroups.com... > Is it possible to achieve something like this? > > switch (mystring.charAt(0)) { > case 'a'..'z': > // do something > break; > } > There are times when an if statement may be more appropriate ;) Sorry - java is not VB :) -- LTP :) cruster schreef: > Is it possible to achieve somethi...

replacement for '{' and '}' ?
I am still playing around with what kind of syntax I would like to mark up my documents. Are there equivalent long substitutes for { and } when they are not used to describe arguments to functions? Something like \begin{group} and \end{group}. In other words, if I could force myself to write, say, \begin{group} \it ... \end{group} instead of {\it ... }, then I believe I could identify from the markup context what is an argument that belongs to a just invoked macro and what is text. {Of course, in this context, \textit{...} would be better.} No more ambiguity whether a in \myfunction{a} is an argument or just text. Is there a way to make latex barf when it sees an ordinary '{' in text, rather than \begin{group}, but not barf when I want it (to denote macro arguments)? Regards, /iaw On Aug 16, 6:01=A0pm, "ivo...@gmail.com" <ivo...@gmail.com> wrote: > Is there a way to make latex barf when it sees an ordinary '{' in > text, rather than \begin{group}, but not barf when I want it (to > denote macro arguments)? What do you mean exactly? I don't understand. Do you have in mind your- to-be-new-syntax or just regular latex? Cheers, Tomek ivowel@gmail.com wrote: > I am still playing around with what kind of syntax I would like to > mark up my documents. > > Are there equivalent long substitutes for { and } when they are not > used to describe arguments to functions? Something like \begin{group} > and \end{gr...

'[OFF]' as in 'offensive'???
Hi, given that 'off-topicness' is indicated as '[OT]' and taking a look at those postings that started the threads indicated as '[OFF]' (which may both be seen as being somewhat offensive) may lead to the conclusion that '[OFF]' stands for offensiveness. I don't think that this is the intended meaning so what actually *does* '[OFF]' mean? I never came across that abbreviation before (although I have been around on the USENET for quite some time) but maybe it is worth knowing? Josef 'Jupp' Schugt NOTE: mails >100 KiB ...

Web resources about - AttributeError: 'list' object has no attribute 'lower' - comp.lang.python

Resources last updated: 3/13/2016 7:02:43 AM