Error to upload a binary file
Closed this issue · 2 comments
GoogleCodeExporter commented
I modified the function testFile_Create_Upload_Download for try to upload a
audio file.
filedata = open('audio.mp3', 'r').read()
And I get this error:
File "/home/martin/Projects/CloudSync/pyacd/multipart.py", line 73, in
encode_multipart_formdata
body = CRLF.join(L)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8f in position 242:
ordinal not in range(128)
I use pyacd r29 and Python 2.6.6
When I try to upload with Python 2.7 I get the error:
File "/home/martin/Projects/CloudSync/pyacd/multipart.py", line 30, in post_multipart
conn.request(method,path,body,hs)
File "/usr/lib/python2.7/httplib.py", line 935, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 968, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python2.7/httplib.py", line 915, in putheader
str = '%s: %s' % (header, '\r\n\t'.join(values))
Changing the line 18, I solved the error:
hs={'content-type': content_type,'content-length': str(len(body))}
Original issue reported on code.google.com by newluxf...@gmail.com
on 29 Apr 2011 at 10:50
GoogleCodeExporter commented
Thanks for your reporting.
Tests with the binary file was missed.
I will fix this issue.
Original comment by sakurai....@gmail.com
on 19 May 2011 at 10:36
- Changed state: Accepted
- Added labels: Priority-Critical
- Removed labels: Priority-Medium
GoogleCodeExporter commented
Possibly two problems are fixed in r30.
And when you upload the binary file, "open('audio.mp3', 'rb')" is better than
"open('audio.mp3', 'r')".
Regards.
Original comment by sakurai....@gmail.com
on 20 May 2011 at 1:31
- Changed state: Fixed