sqlite3.OperationalError: Could not decode to UTF-8 column

Carsten Haese carsten at uniqsys.com
Wed Sep 5 18:32:45 CEST 2007


On Wed, 2007-09-05 at 16:40 +0100, Filipe Sousa wrote:
> Hi
> 
> I'm trying to use sqlite with python 2.5 but I have this problem:
> 
> Traceback (most recent call last):
>    File "converter.py", line 13, in <module>
>      c_old.execute('select id_aluno, nome from aluno')
> sqlite3.OperationalError: Could not decode to UTF-8 column 'nome' with 
> text 'Ana Margarida Fernandes Gonçalves de Sá'
> 
> The database was created with another program and all data is in 
> database is in latin1.

Try setting

conn.text_factory = str

where conn is the name of your sqlite3 connection object. See
http://docs.python.org/lib/sqlite3-Connection-Objects.html for more
information.

HTH,

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list