''.join([x() for x in corpus])def findWholeWord(w):
return re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE).search
item = ['ii']
fnval = ['i', 'we', 'cake', 'love', 'time', ]
fadmin = ['admin','give',]
G3 = [one(), two(), three()]
G4 = [four(), five()]
l = []
def testing():
while True:
for c in fnval:
if findWholeWord(c)(item[0]):
print 'yes'
for c in fadmin:
if findWholeWord(c)(item[0]):
print 'yes admin'
break<type 'exceptions.TypeError'> 'NoneType' object is not callable''.join(y for y in [x() for x in corpus] if y is not None)Where and how is the list of functions to be called (corpus) defined? The mistake is obviously there as one of the values in corpus is not a function it's a None.
Also if the functions sometimes return a None value (the error would be different but) you cannot join them like that since None is not a string so you need to do filter out the Nones with something like
''.join(y for y in [x() for x in corpus] if y is not None)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/KRSp3bD-LDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Maurice telling me corpus is defined in the controller doesn't help me at all, I need to see how you are picking the functions you put there to see why one could be None. A possible reason is that you have a dictionary of keys with a function as the value of each key, you then do a get from that dictionary which will return a None if the function isn't there.
--
Ok, the error is not there, the error is inside one of the corpus functions.
--
If you want to do that right you need to do natural language processing e.g. using python nltk.
--
--