文章参考:http://eric.themoritzfamily.com/python-encodings-and-unicode.htmlphp
http://desert3.iteye.com/blog/757508html
https://github.com/misfo/Shell-Turtlestein/issues/6python
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=2610git
https://github.com/uipoet/sublime-jshint/issues/24github
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=2441&start=0&hilit=getfilesystemencoding(*)ui
完整的错误是:spa
Traceback (most recent call last):
File ".\sublime_plugin.py", line 325, in run_
File ".\exec.py", line 145, in run
File ".\exec.py", line 42, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9: ordinal not in range(128).net
这些文章不少是有重复内容的,我主要看的是后面标*的那一篇;code
这个问题的原由是配置文件目录下Packages\Default目录下的exec.py在编辑环境变量,可是环境变量中的字符集确少了ascii字符集htm
个人解决方案(参靠上面第6篇):
找到配置文件目录位置(能够参考个人另外一篇博文修改sublime Text 的默认配置文件位置)
其中的Packages\Default\exec.py,打开编辑
找到第41-42行:
for k, v in proc_env.iteritems():
proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
两种修改方案:
一、果断删掉!(你没看错,就是这样)
二、对它进行异常处理,避免它出错时中止程序运行就像这样:
for k, v in proc_env.iteritems():
try:
proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
except UnicodeDecodeError:
print "Encoding error..."
print "VARIABLE: ", k, " : ", v
而后你在尝试对pyhon或是其余程序的编译,就会发现切正常了!