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

Use getpreferredencoding() to detect encoding

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