Literal Escaped Octets

Chason Hayes chasonh at hotmail.com
Sun Feb 5 23:40:31 EST 2006


I am trying to convert raw binary data to data with escaped octets in
order to store it in a bytea field on postgresql server. I could do this
easily in c/c++ but I need to do it in python. I am not sure how to read
and evaluate the binary value of a byte in a long string when it is a non
printable ascii value in python. I read some ways to use unpack from the
struct module, but i really couldn't understand where that would help. I
looked at the MIMIEncode module but I don't know how to convert the object
to a string. Is there a module that will convert the data? It seems to me
that this question must have been answered a million times before but I
can't find anything.



See http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html
for a description of the problem domain.





More information about the Python-list mailing list