Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError with python 3 #543

Closed
IljaKroonen opened this issue Jun 1, 2016 · 2 comments
Closed

UnicodeEncodeError with python 3 #543

IljaKroonen opened this issue Jun 1, 2016 · 2 comments

Comments

@IljaKroonen
Copy link

I'm running caravel on python3.4 and in a docker based on ubuntu 14. When I select a filter value that contains an accent (for example, "Société"), I get the following error on all my slices.
The datasource is SQL Server (azure version).
In other instances, for example when accents are shown as labels in visualizations, it works perfectly fine.

builtins.UnicodeEncodeError
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 244: ordinal not in range(128)

Traceback (most recent call last)
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/Flask-0.11-py3.4.egg/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.4/dist-packages/Flask_AppBuilder-1.7.0-py3.4.egg/flask_appbuilder/security/decorators.py", line 26, in wraps
return f(self, *args, **kwargs)
File "/caravel/source/caravel/models.py", line 1305, in wrapper
return f(*args, **kwargs)
File "/caravel/source/caravel/views.py", line 671, in explore
payload = obj.get_json()
File "/caravel/source/caravel/viz.py", line 260, in get_json
'data': self.get_data(),
File "/caravel/source/caravel/viz.py", line 370, in get_data
df = self.get_df()
File "/caravel/source/caravel/viz.py", line 362, in get_df
df = super(TableViz, self).get_df(query_obj)
File "/caravel/source/caravel/viz.py", line 146, in get_df
self.results = self.datasource.query(**query_obj)
File "/caravel/source/caravel/models.py", line 729, in query
print(sql)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 244: ordinal not in range(128)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
@IljaKroonen
Copy link
Author

I found an easy fix for this issue, which is setting the PYTHONIOENCODING environment variable to UTF-8 (otherwise, python thinks it can't send UTF8 characters to the terminal)
In docker, this can be done with -e PYTHONIOENCODING=UTF-8

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 622 days. Feel free to comment and request for this issue to be reopened.

zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
Bumps [lerna](https://github.com/lerna/lerna/tree/HEAD/core/lerna) from 3.21.0 to 3.22.0.
- [Release notes](https://github.com/lerna/lerna/releases)
- [Changelog](https://github.com/lerna/lerna/blob/master/core/lerna/CHANGELOG.md)
- [Commits](https://github.com/lerna/lerna/commits/v3.22.0/core/lerna)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
Bumps [lerna](https://github.com/lerna/lerna/tree/HEAD/core/lerna) from 3.21.0 to 3.22.0.
- [Release notes](https://github.com/lerna/lerna/releases)
- [Changelog](https://github.com/lerna/lerna/blob/master/core/lerna/CHANGELOG.md)
- [Commits](https://github.com/lerna/lerna/commits/v3.22.0/core/lerna)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
Bumps [lerna](https://github.com/lerna/lerna/tree/HEAD/core/lerna) from 3.21.0 to 3.22.0.
- [Release notes](https://github.com/lerna/lerna/releases)
- [Changelog](https://github.com/lerna/lerna/blob/master/core/lerna/CHANGELOG.md)
- [Commits](https://github.com/lerna/lerna/commits/v3.22.0/core/lerna)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
Bumps [lerna](https://github.com/lerna/lerna/tree/HEAD/core/lerna) from 3.21.0 to 3.22.0.
- [Release notes](https://github.com/lerna/lerna/releases)
- [Changelog](https://github.com/lerna/lerna/blob/master/core/lerna/CHANGELOG.md)
- [Commits](https://github.com/lerna/lerna/commits/v3.22.0/core/lerna)

Signed-off-by: dependabot-preview[bot] <[email protected]>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants