diff --git a/IPython/utils/_process_win32.py b/IPython/utils/_process_win32.py index 31ec63a..7a39f4a 100644 --- a/IPython/utils/_process_win32.py +++ b/IPython/utils/_process_win32.py @@ -29,6 +29,7 @@ from subprocess import STDOUT from ._process_common import read_no_interrupt, process_handler, arg_split as py_arg_split from . import py3compat from . import text +from .encoding import getdefaultencoding #----------------------------------------------------------------------------- # Function definitions @@ -94,7 +95,7 @@ def _find_cmd(cmd): def _system_body(p): """Callback for _system.""" - enc = py3compat.getdefaultencoding() + enc = getdefaultencoding() for line in read_no_interrupt(p.stdout).splitlines(): line = line.decode(enc, 'replace') print(line, file=sys.stdout) diff --git a/IPython/utils/py3compat.py b/IPython/utils/py3compat.py index 3588a3a..97e31f4 100644 --- a/IPython/utils/py3compat.py +++ b/IPython/utils/py3compat.py @@ -6,7 +6,9 @@ import sys import re import types -from IPython.utils.encoding import getdefaultencoding +from .encoding import getdefaultencoding + +default_encoding = getdefaultencoding() orig_open = open @@ -14,11 +16,11 @@ def no_code(x, encoding=None): return x def decode(s, encoding=None): - encoding = encoding or getdefaultencoding() + encoding = encoding or default_encoding return s.decode(encoding, "replace") def encode(u, encoding=None): - encoding = encoding or getdefaultencoding() + encoding = encoding or default_encoding return u.encode(encoding, "replace")