Skip to content

Commit

Permalink
fix for #3061, only for PY3 as requested, 2nd try
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Mar 14, 2016
1 parent 857446b commit 8f6d7e1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spyderlib/widgets/externalshell/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _print(*objects, **options):

#==============================================================================
# Execfile functions
#
#
# The definitions for Python 2 on Windows were taken from the IPython
# project (present in IPython.utils.py3compat)
# Copyright (C) The IPython Development Team
Expand Down Expand Up @@ -96,7 +96,7 @@ def execfile(filename, namespace):


#==============================================================================
# Colorization of sys.stderr (standard Python interpreter)
# Colorization of sys.stderr (standard Python interpreter)
#==============================================================================
if os.environ.get("COLORIZE_SYS_STDERR", "").lower() == "true":
class StderrProxy(object):
Expand Down Expand Up @@ -150,7 +150,7 @@ def write(self, text):
# Setting console encoding (otherwise Python does not recognize encoding)
# for Windows platforms
#==============================================================================
if os.name == 'nt' and PY2:
if PY2 and os.name == 'nt':
try:
import locale, ctypes
_t, _cp = locale.getdefaultlocale('LANG')
Expand Down Expand Up @@ -278,7 +278,7 @@ def open_in_spyder(source, lineno=1):

def qt_nt_inputhook():
"""Qt input hook for Windows
This input hook wait for available stdin data (notified by
ExternalPythonShell through the monitor's inputhook_flag
attribute), and in the meantime it processes Qt events.
Expand All @@ -296,7 +296,7 @@ def qt_nt_inputhook():
sys.stdin.tell()
except IOError:
return 0

# Input hook
app = QtCore.QCoreApplication.instance()
if app and app.thread() is QtCore.QThread.currentThread():
Expand All @@ -307,7 +307,7 @@ def qt_nt_inputhook():
timer.start(50)
QtCore.QCoreApplication.exec_()
timer.stop()

# Socket-based alternative:
#socket = QtNetwork.QLocalSocket()
#socket.connectToServer(os.environ['SPYDER_SHELL_ID'])
Expand Down Expand Up @@ -362,7 +362,7 @@ def set_mpl_backend(backend):
('PySide', 'Qt4Agg', 'pyqt')]
if not os.name == 'nt':
backends.append( ('_tkinter', 'TkAgg', None) )

for b in backends:
mpl_backend = set_mpl_backend(b)
if mpl_backend:
Expand Down Expand Up @@ -446,7 +446,7 @@ def __init__(self, *args, **kwargs):
kwargs['exit'] = False
TestProgram.__init__(self, *args, **kwargs)
unittest.main = IPyTesProgram

# Pandas monkey-patches
try:
# Make Pandas recognize our IPython consoles as proper qtconsoles
Expand All @@ -455,12 +455,12 @@ def in_qtconsole():
return True
import pandas as pd
pd.core.common.in_qtconsole = in_qtconsole

# Set Pandas output encoding
pd.options.display.encoding = 'utf-8'
except (ImportError, AttributeError):
pass


#==============================================================================
# Pdb adjustments
Expand Down Expand Up @@ -503,7 +503,7 @@ def notify_spyder(self, frame):
if osp.isfile(fname) and monitor is not None:
monitor.notify_pdb_step(fname, lineno)
time.sleep(0.1)

pdb.Pdb = SpyderPdb

#XXX: I know, this function is now also implemented as is in utils/misc.py but
Expand Down Expand Up @@ -594,7 +594,7 @@ def break_here(self, frame):
lineno = frame.f_code.co_firstlineno
if not lineno in self.breaks[filename]:
return False

# flag says ok to delete temp. bp
(bp, flag) = effective(filename, lineno, frame)
if bp:
Expand Down Expand Up @@ -625,7 +625,7 @@ def break_here(self, frame):
#==============================================================================
class UserModuleReloader(object):
"""
User Module Reloader (UMR) aims at deleting user modules
User Module Reloader (UMR) aims at deleting user modules
to force Python to deeply reload them during import
pathlist [list]: blacklist in terms of module path
Expand Down

0 comments on commit 8f6d7e1

Please sign in to comment.