coercing to Unicode: need string or buffer, NoneType found

Jon Bowlas j.bowlas at ucl.ac.uk
Thu Jul 27 06:24:06 EDT 2006


Ahh, that did it, thanks very much.

Jon
----- Original Message ----- 
From: <blue99 at interia.pl>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Thursday, July 27, 2006 11:19 AM
Subject: Re: coercing to Unicode: need string or buffer, NoneType found


> 
> 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
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list