UnicodeDecodeError

IPython note book is very useful tool.
When I tried to use ipython notebook, I got following error.

(python_test_env) iwatobipen$ ipython notebook
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 13898: ordinal not in range(128)

To avoid this error, change the default encode from “ascii” to “utf-8”.
Put the setcustomize.py file in your site-packages/directly.
I’m using virtualenv, so I put that file in => /Users/iwatobipen/python_test_env/lib/python2.7/site-packages

setcustomize.py
import sys
sys.setdefaultencoding("utf-8")

Then retry “IPython notebook” command, it works well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s