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 10 element and than gives me this error: cursor2.execute("INSERT INTO cache VALUES ('%s', %s)", (x[0],a)) psycopg2.ProgrammingError: invalid input syntax for type bytea i try in LATIN5 (data type TEXT) and it add all element but when i want to load it give me this error: pickle.loads(SELECTED_DATA); EOFError Now how can i store the pickle data ? Which encoding and which data type ? Please help me i'm sorry my bad english. King Regards.. -- http://mail.python.org/mailman/listinfo/python-list