coercing to Unicode: need string or buffer, NoneType found

blue99 at interia.pl blue99 at interia.pl
Thu Jul 27 06:19:17 EDT 2006


Jon Bowlas wrote:

> Here's my script:
>
> results = context.module_retriever().tuples() # call to ZSQLMethod
> converted = []
> for result in results:
>    result = list(result) # make a list from the tuple
>    for i in range(len(result)):
>     # for each element in the listified tuple, make decode to a
>     # unicode from the latin-1 string

try this:
       if result[i] is None: continue

>     result[i] = unicode(result[i], 'latin-1')
>    converted.append(tuple(result)) # tuplify again
> return converted

regards,
Rob




More information about the Python-list mailing list