need to set default encoding for output of subprocess
faywong opened this issue · 1 comments
faywong commented
There's error when check output of subprocess in Chinese language & Mac OS.
Exception in thread Thread-33:
Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "/Users/faywong/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package/rsync_ssh.py", line 567, in run
output = check_output(rsync_command, stderr=subprocess.STDOUT)
File "/Users/faywong/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package/rsync_ssh.py", line 43, in check_output
return subprocess.check_output(*args, universal_newlines=True, startupinfo=startupinfo, **kwargs)
File "./python3.3/subprocess.py", line 578, in check_output
File "./python3.3/subprocess.py", line 907, in communicate
File "./python3.3/subprocess.py", line 479, in _eintr_retry_call
File "./python3.3/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 50: ordinal not in range(128)
May be
import sys
reload(sys)
sys.setdefaultencoding(‘utf8′)
helps.