[ale] [ot?] Python question
Michael B. Trausch
fd0man at gmail.com
Sun Apr 1 13:37:52 EDT 2007
I already asked the Python mailing list, and it seems that they are
unwilling to help. Basically, I have a situation wherein I have a
binary file (a JPG in this case) that I want to add to a string which
contains Unicode, in order to send to a server. The server doesn't seem
to accept Base64 (or quoted-printable, or any of that stuff), so I need
to send the raw binary image to the server as part of the message.
Python tells me that this is an error:
>>> sb.UploadSinglePicture('/home/mbt/IMG_2618.JPG')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scrapbook.py", line 181, in UploadSinglePicture
{Request['UploadPic.Meta.Filename']: pic_mem})
File "scrapbook.py", line 237, in ComposeMIME
return(self.EncodeMIME(fields, files))
File "scrapbook.py", line 226, in EncodeMIME
body = eol.join(L)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0:
ordinal not in range(128)
>>>
I am aware that the binary file contains sequences that are neither
ASCII nor UTF-8 or any other encoding. That's not really the issue?I
just need it to work. Are there any ideas? I have not, as of yet,
found the answer on Google, though I have found tons of complaints
regarding similar situations.
? Mike
--
Michael B. Trausch
fd0man at gmail.com
Phone: (404) 592-5746
Jabber IM:
fd0man at gmail.com
fd0man at livejournal.com
Demand Freedom! Use open and free protocols, standards, and software!
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the Ale
mailing list