Skip to content

Instantly share code, notes, and snippets.

@striveforbest
Last active February 4, 2017 02:50
Show Gist options
  • Save striveforbest/1e5d926cf8f75b9e756ce200b777bbd8 to your computer and use it in GitHub Desktop.
Save striveforbest/1e5d926cf8f75b9e756ce200b777bbd8 to your computer and use it in GitHub Desktop.
WagtailSearch UnicodeDecodeError if using with AWS ElasticSearch and Page.title has special characters
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/wagtail/wagtailsearch/management/commands/update_index.py", line 120, in handle
self.update_backend(backend_name, schema_only=options['schema_only'])
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/wagtail/wagtailsearch/management/commands/update_index.py", line 87, in update_backend
index.add_items(model, chunk)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py", line 573, in add_items
bulk(self.es, actions)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 190, in bulk
for ok, item in streaming_bulk(client, actions, **kwargs):
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 162, in streaming_bulk
for result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs):
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 87, in _process_bulk_chunk
resp = client.bulk('\n'.join(bulk_actions) + '\n', **kwargs)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 785, in bulk
doc_type, '_bulk'), params=params, body=self._bulk_body(body))
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/elasticsearch/transport.py", line 328, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/Users/striveforbest/venv/americana/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 "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/Users/striveforbest/venv/americana/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1042, in request
self._send_request(method, url, body, headers)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1082, in _send_request
self.endheaders(body)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 880, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17345: ordinal not in range(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment