refinery-platform icon indicating copy to clipboard operation
refinery-platform copied to clipboard

UnicodeEncodeError in render_data_set_visualization_creation

Open hackdna opened this issue 6 years ago • 3 comments

  • Specific code commit: v1.6.6.2
  • Version of the web browser and OS: N/A
  • Environment where the error occurred: AWS

Steps to reproduce

Unknown, error report received by email

Observed behavior

Refinery log:

Internal Server Error: /api/v2/events/
Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/srv/refinery-platform/refinery/core/views.py", line 645, in get
    return Response(serializer.data)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/serializers.py", line 674, in data
    ret = super(ListSerializer, self).data
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/serializers.py", line 239, in data
    self._data = self.to_representation(self.instance)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/serializers.py", line 614, in to_representation
    self.child.to_representation(item) for item in iterable
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/serializers.py", line 472, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/home/ubuntu/.virtualenvs/refinery-platform/lib/python2.7/site-packages/rest_framework/fields.py", line 1653, in to_representation
    return method(value)
  File "/srv/refinery-platform/refinery/core/serializers.py", line 150, in get_message
    return unicode(obj)
  File "/srv/refinery-platform/refinery/core/models.py", line 2559, in __unicode__
    return self.render_data_set_visualization_creation()
  File "/srv/refinery-platform/refinery/core/models.py", line 2401, in render_data_set_visualization_creation
    self.data_set.name
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 45: ordinal not in range(128)

Request repr():
<WSGIRequest
path:/api/v2/events/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'_ga': 'GA1.2.1639004996.1517425836',
'_gat_gtag_UA_68942400_4': '1',
'_gid': 'GA1.2.1293377466.1537192882',
'csrftoken': <redacted>,
'sessionid': <redacted>},
META:{'CONTEXT_DOCUMENT_ROOT': '/var/www',
'CONTEXT_PREFIX': '',
u'CSRF_COOKIE': <redacted>,
'DOCUMENT_ROOT': '/var/www',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_ACCEPT': 'application/json, text/plain, */*',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.9',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_COOKIE': '_ga=GA1.2.1639004996.1517425836; _gid=GA1.2.1293377466.1537192882; csrftoken=<redacted>; sessionid=<redacted>; _gat_gtag_UA_68942400_4=1',
'HTTP_HOST': 'hsci.stemcellcommons.org',
'HTTP_REFERER': 'https://hsci.stemcellcommons.org/dashboard/',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36',
'HTTP_X_CSRFTOKEN': <redacted>,
'HTTP_X_FORWARDED_FOR': '134.174.140.132',
'HTTP_X_FORWARDED_PORT': '443',
'HTTP_X_FORWARDED_PROTO': 'https',
'PATH_INFO': u'/api/v2/events/',
'PATH_TRANSLATED': '/srv/refinery-platform/refinery/config/wsgi_aws.py/api/v2/events/',
'QUERY_STRING': '',
'REMOTE_ADDR': '172.30.0.107',
'REMOTE_PORT': '27560',
'REQUEST_METHOD': 'GET',
'REQUEST_SCHEME': 'http',
'REQUEST_URI': '/api/v2/events/',
'SCRIPT_FILENAME': '/srv/refinery-platform/refinery/config/wsgi_aws.py',
'SCRIPT_NAME': u'',
'SCRIPT_URI': 'http://hsci.stemcellcommons.org/api/v2/events/',
'SCRIPT_URL': '/api/v2/events/',
'SERVER_ADDR': '172.30.0.207',
'SERVER_ADMIN': '[no address given]',
'SERVER_NAME': 'hsci.stemcellcommons.org',
'SERVER_PORT': '80',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SIGNATURE': '',
'SERVER_SOFTWARE': 'Apache/2.4.7 (Ubuntu)',
'mod_wsgi.application_group': 'hsci.stemcellcommons.org|',
'mod_wsgi.callable_object': 'application',
'mod_wsgi.enable_sendfile': '0',
'mod_wsgi.handler_script': '',
'mod_wsgi.input_chunked': '0',
'mod_wsgi.listener_host': '',
'mod_wsgi.listener_port': '80',
'mod_wsgi.process_group': 'refinery',
'mod_wsgi.queue_start': '1537372491613096',
'mod_wsgi.request_handler': 'wsgi-script',
'mod_wsgi.script_reloading': '1',
'mod_wsgi.version': (3, 4),
'wsgi.errors': <mod_wsgi.Log object at 0x7f1a701abb30>,
'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7f1a4a9483f0>,
'wsgi.input': <mod_wsgi.Input object at 0x7f1a70738df0>,
'wsgi.multiprocess': False,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>

Expected behavior

No internal server error

Notes

See also #2999 Fix should be compatible with Python 3

hackdna avatar Sep 19 '18 16:09 hackdna

Ref #2619

jkmarx avatar Nov 15 '18 15:11 jkmarx

Still an issue as of v1.6.9.1

hackdna avatar May 28 '19 17:05 hackdna

Still an issue in v1.6.9.1

hackdna avatar Jun 21 '19 17:06 hackdna