UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
See original GitHub issueMake sure these boxes are checked before submitting your issue - thank you!
[-] I have checked the superset logs for python stacktraces and included it here as text if any [-] I have reproduced the issue with at least the latest released version of superset [-] I have checked the issue tracker for the same issue and I haven’t found one similar
Superset version
0.18.2
Expected results
Graphic a column diagram product sales group by date.
Actual results
Throws an exception: UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Detail Stack Info:
2017-05-17 17:27:56,137:INFO:root:SELECT `TIMESTAMP` AS `TIMESTAMP`, product AS product, COUNT(*) AS count
FROM ja_act_lotterylog
WHERE `TIMESTAMP` >= STR_TO_DATE('2016-11-20 17:27:56', '%%Y-%%m-%%d %%H:%%i:%%s') AND `TIMESTAMP` <= STR_TO_DATE('2016-11-30 17:27:56', '%%Y-%%m-%%d %%H:%%i:%%s') GROUP BY `TIMESTAMP`, product ORDER BY count DESC
LIMIT 50000
2017-05-17 17:28:05,548:ERROR:root:'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/superset/viz.py", line 237, in get_payload
data = self.get_data(df)
File "/usr/lib/python2.7/site-packages/superset/viz.py", line 1113, in get_data
x = str(x)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
2017-05-17 17:28:05,551:INFO:root:Caching for the next 600000 seconds
Steps to reproduce
Add a MySQL datasource and table, then click Sources --> Tables --> Query, after that show result like below:
MySQL table data:
Remember that some meta data use in Chinese.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
UnicodeEncodeError: 'ascii' codec can't encode character ...
The issue is that when you call str(), python uses the default character encoding to try and encode the bytes you gave it,...
Read more >Fix Python UnicodeEncodeError: 'ascii' codec can't encode ...
UnicodeEncodeError : 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128). Additionally, when writing pandas DataFrames ...
Read more >UnicodeEncodeError 'ascii' 'ordinal not in range(128)'
UnicodeEncodeError : 'ascii' codec can't encode character u'\xa3' in position 53331: ordinal not in range(128) Before the test I made above, ...
Read more >'ascii' codec can't encode character '\xe9' in position 117: ...
UnicodeEncodeError : 'ascii' codec can't encode character '\xe9' in position 117: ordinal not in range(128) #10219. Closed. 1 task done.
Read more >UnicodeEncodeError: 'ascii' codec can't encode character ...
This error occurs when we pass a Unicode string containing non-English characters (Unicode characters beyond 128) to something that expects an ASCII ......
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 FreeTop 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
Top GitHub Comments
Also if you’re not using py3 it may help
@RichardKyire I don’t known the deep reason. May you can check the DB environment suggest to use the “UTF-8” charset.