首页 > 代码库 > 解决 UnicodeDecodeError: 'ascii' codec can't decode 错误

解决 UnicodeDecodeError: 'ascii' codec can't decode 错误

Ctrl + B 没结果。

查看控制台信息 如下:


Running python -u -i C:\2.py
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 337, in run_
  File ".\exec.py", line 154, in run
  File ".\exec.py", line 45, in __init__
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xd3 in position 1035: ordinal not in range(128)


解决方法:

    exec.py

    sublime_plugin.py 两个文件

前面加上 如下代码

    import sys 
    reload(sys) 
    sys.setdefaultencoding(‘gbk‘)



解决 UnicodeDecodeError: 'ascii' codec can't decode 错误