On Oct 18, 8:53 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> Abandoned <[EMAIL PROTECTED]> writes:
> > > When you load it, convert the string to dict with cPickle.loads
> > > instead of with eval.
>
> > Yes i understand and this very very good ;)
>
> Good!  :-)
>
> > 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".
>
> Use a different column type for cache2's column, one more appropriate
> for storing binary characters (perhaps BYTEA for Postgres).  Don't
> forget to also use a bind variable, something like:
>
> cursor.execute("INSERT INTO cache2 VALUES (?)", a)
>
> Using "INSERT ... ('%s')" % (a) won't work, since the huge binary
> string in a can contain arbitrary characters, including the single
> quote.

I tryed:
cursor.execute("INSERT INTO cache2 VALUES (?)", a)
and
cursor.execute("INSERT INTO cache2 VALUES (%s)", (a,) )
but the result is same..

> 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".

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to