Answer the question
In order to leave comments, you need to log in
Sublime Text 2 and Python 2.7: UnicodeEncodeError
OS: Windows 7 64-bit,
Just installed Sublime Text 2 and Python 2.7.
When executing this code: I get an
a = 10
print a
error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 35-39: ordinal not in range(128).
I googled that I need to change the line in the exec.py file to look like this,
proc_env[k] = os.path.expandvars(v.decode(sys.getfilesystemencoding())).encode(sys.getfilesystemencoding())
but in my case it does not help.
Nobody faced such a problem? I'm not good at programming, I wanted to figure it out.
Answer the question
In order to leave comments, you need to log in
Set the encoding for the BOM source
And make sure the first line in the script:
# -*- coding: UTF-8 -*-
Correct in the file `../sublime-text-2/Packages/Default/exec.py`
class ExecCommand(sublime_plugin.WindowCommand, ProcessListener):
def run(self, cmd = [], file_regex = "", line_regex = "", working_dir = "",
encoding = "utf-8", env = {}, quiet = False, kill = False,
# Catches "path" and "shell"
**kwargs):
# Добавьте следующую строку
cmd = [c.encode(sys.getfilesystemencoding()) for c in cmd]
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question