提交 c800e667 authored 作者: cai-lw's avatar cai-lw

Use getpreferredencoding() to detect encoding

上级 f40bb97f
......@@ -68,7 +68,7 @@ else:
def decode_with(x, encoding):
return x
__all__ += ['cmp', 'operator_div', 'DictMixin', 'OrderedDict', 'decode',
'decode_iter', 'get_unbound_function', 'imap', 'izip', 'ifilter']
......
......@@ -5,6 +5,7 @@ import os
import subprocess
import sys
import warnings
from locale import getpreferredencoding
import numpy
......@@ -357,9 +358,10 @@ class NVCC_compiler(Compiler):
os.chdir(location)
p = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
nvcc_stdout, nvcc_stderr = p.communicate()[:2]
nvcc_stdout = decode_with(nvcc_stdout, p.stdout.encoding)
nvcc_stderr = decode_with(nvcc_stderr, p.stderr.encoding)
nvcc_stdout_raw, nvcc_stderr_raw = p.communicate()[:2]
console_encoding = getpreferredencoding()
nvcc_stdout = decode_with(nvcc_stdout_raw, console_encoding)
nvcc_stderr = decode_with(nvcc_stderr_raw, console_encoding)
finally:
os.chdir(orig_dir)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论