#What to do if you get an error like this
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position xx: ordinal not in range(128)
import sys
print sys.getdefaultencoding()
#>>'ascii'This is utf because ascii is the default-The goal is to be 8
#site-Find a folder called pacages
find / -name site-packages
#I think there are some results, but if you are using homebrew python, this is awkward
#/usr/local/lib/python2.7/site-packages/
Add the following to the top of sitecustomize.py in the site-packages identified above
sitecustomize.py
import sys
sys.setdefaultencoding("utf-8")
import sys
sys.getdefaultencoding()
#>>'utf-8'The default encoding is utf-Became 8
Recommended Posts