UnicodeDecodeError: 'ascii' codec can't decode byte
See original GitHub issueHello,
I’ve searched for this error and have found several closed issues for this error, but I am getting the following error:
Traceback (most recent call last):
File "/webroot/common-content/new_lambda_function.py", line 52, in lambda_handler
index_response = es.index(index="resources", doc_type="resource", id=resource['content']['id'], body=resource['content'])
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 279, in index
_make_path(index, doc_type, id), params=params, body=body)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 329, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/elasticsearch/connection/http_requests.py", line 68, in perform_request
response = self.session.request(method, url, data=body, timeout=timeout or self.timeout)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/webroot/common-content/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 353, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 979, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1013, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 833, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 568: ordinal not in range(128)
It seems that a previously posted workaround has been implemented (https://github.com/elastic/elasticsearch-py/issues/374). This issue report is my problem exactly, is there any solution to this with Python 2.7? There is no chance of converting to Python 3 since AWS Lambda does not support it.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to fix: "UnicodeDecodeError: 'ascii' codec can't decode ...
UnicodeDecodeError: 'ascii' codec can't decode byte generally happens when you try to convert a Python 2.x str that contains non-ASCII to a Unicode...
Read more >UnicodeDecodeError: 'ascii' codec can't decode byte
The Python "UnicodeDecodeError: 'ascii' codec can't decode byte in position" occurs when we use the ascii codec to decode bytes that were ...
Read more >UnicodeDecodeError: 'ascii' codec can't decode byte - Intellipaat
1 Answer. To fix “UnicodeDecodeError you can use the following piece of code this is the default encoding of python is utf8. After...
Read more >UnicodeDecodeError: 'ascii' codec can't decode byte - GitHub
Questions and Help I am facing this issue , When I run the VQA colab notebook it works perfectly well , but when...
Read more >UnicodeDecodeError - Python Wiki
Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I fix this isuue with this hack: http://stackoverflow.com/a/17628350/482177
Any better way to fix it?