Hi,
I find the correct method to attach a blob with the python automation client (answer how-to-call-blobattach-via-rest-api-in-python)
/>
Perfect for ascii files, but when i try to attach a blob like a pdf or a csv, I have an error UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 464: ordinal not in range(128)
I am on Ubuntu 12.04 / python 2.7.6 / Nuxeo 5.8
Someone have an idea ?
Thanks
Trace :
ERROR:root:'ascii' codec can't decode byte 0xe9 in position 464: ordinal not in range(128)
Traceback (most recent call last):
File "perso_test2.py", line 21, in <module>
s.attachBlob(doc['uid'],'/home/administrateur/test3.csv')
File "/usr/local/lib/python2.7/dist-packages/nuxeo_automation-0.1-py2.7.egg/nuxeoautomation.py", line 93, in attachBlob
return self._attach_blob(blob, document=ref)
File "/usr/local/lib/python2.7/dist-packages/nuxeo_automation-0.1-py2.7.egg/nuxeoautomation.py", line 183, in _attach_blob
resp = self.opener.open(req)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1174, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib/python2.7/httplib.py", line 958, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 812, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 464: ordinal not in range(128)