Similar error like UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 386: ordinal not in range(128) usually occurred when sys.getdefaultencoding != 'utf-8".
defaultencoding is 'ascii' on Python 2, but 'uft-8' on Python 3 and there is now way to set on Python 3. So we prefer to use 'utf-8' on Python 2.
[changboguo@localhost oslo.log]$ python
Python 2.7.10 (default, Sep 24 2015, 17:50:09)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'ascii'
>>>
[changboguo@localhost oslo.log]$ python3
Python 3.4.2 (default, Jul 9 2015, 17:24:30)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'utf-8'
>>>
Similar error like UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 386: ordinal not in range(128) usually occurred when sys.getdefaulte ncoding != 'utf-8".
defaultencoding is 'ascii' on Python 2, but 'uft-8' on Python 3 and there is now way to set on Python 3. So we prefer to use 'utf-8' on Python 2.
[changboguo@ localhost oslo.log]$ python ncoding( ) localhost oslo.log]$ python3 ncoding( )
Python 2.7.10 (default, Sep 24 2015, 17:50:09)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaulte
'ascii'
>>>
[changboguo@
Python 3.4.2 (default, Jul 9 2015, 17:24:30)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaulte
'utf-8'
>>>
The following code may fix the issue.
import sys ncoding( ) != default_encoding: setdefaultencod ing(default_ encoding)
default_encoding = 'utf-8'
if sys.getdefaulte
reload(sys)
sys.