Skip to content

Commit

Permalink
fix for spyder-ide#3061, only for PY3 as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Mar 14, 2016
1 parent 28f338c commit 857446b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spyderlib/widgets/externalshell/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,25 @@ def write(self, text):
os.environ['SPYDER_PARENT_DIR'] = spyderlib_path


#==============================================================================
# Setting console encoding (otherwise Python does not recognize encoding)
# for Windows platforms
#==============================================================================
if os.name == 'nt' and PY2:
try:
import locale, ctypes
_t, _cp = locale.getdefaultlocale('LANG')
try:
_cp = int(_cp[2:])
ctypes.windll.kernel32.SetConsoleCP(_cp)
ctypes.windll.kernel32.SetConsoleOutputCP(_cp)
except (ValueError, TypeError):
# Code page number in locale is not valid
pass
except ImportError:
pass


#==============================================================================
# Settings for our MacOs X app
#==============================================================================
Expand Down

0 comments on commit 857446b

Please sign in to comment.