How can i store pickle dumps data ?

Diez B. Roggisch deets at nospam.web.de
Sat Oct 20 16:32:22 CEST 2007


Abandoned schrieb:
> Hi..
> I have some dictionary as {2:3, 4:6, 5:7.........}
> I want to pickle to these dictionary and save to database but i
> couldn't..
> 
> My code for adding..
> a=eval(dict)
> a=pickle.dumps(a, -1)
> cursor2.execute("INSERT INTO cache VALUES ('%s', %s)", (x[0],a))
> conn2.commit()
> 
> i try in UTF-8 postresql database (data type BYTEA) and it gives me
> this error:
>> psycopg2.ProgrammingError: invalid byte sequence for encoding "UTF8":
>> 0x80
>> HINT:  This error can also happen if the byte sequence does not match
>> the encoding expected by the server, which is controlled by
>> "client_encoding".
> 
> i try in LATIN5 postgresql database (data type BYTEA) and it add first


http://mail.python.org/pipermail/python-list/2004-September/280867.html


Diez



More information about the Python-list mailing list