Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix ipython-qtconsole when run as a GUI script

  • Loading branch information...
commit e06a43db0eff314af250877da00e939c16ba8033 1 parent 85859d3
@minrk minrk authored
Showing with 12 additions and 7 deletions.
  1. +6 −1 IPython/config/application.py
  2. +6 −6 IPython/zmq/kernelapp.py
View
7 IPython/config/application.py
@@ -161,7 +161,12 @@ def init_logging(self):
"""
self.log = logging.getLogger(self.__class__.__name__)
self.log.setLevel(self.log_level)
- self._log_handler = logging.StreamHandler()
+ if sys.executable.endswith('pythonw.exe'):
+ # this should really go to a file, but file-logging is only
+ # hooked up in parallel applications
+ self._log_handler = logging.StreamHandler(open(os.devnull, 'w'))
+ else:
+ self._log_handler = logging.StreamHandler()
self._log_formatter = logging.Formatter("[%(name)s] %(message)s")
self._log_handler.setFormatter(self._log_formatter)
self.log.addHandler(self._log_handler)
View
12 IPython/zmq/kernelapp.py
@@ -166,18 +166,17 @@ def init_session(self):
"""create our session object"""
self.session = Session(config=self.config, username=u'kernel')
- def init_io(self):
- """redirects stdout/stderr, and installs a display hook"""
- # Re-direct stdout/stderr, if necessary.
+ def init_blackhole(self):
+ """redirects stdout/stderr to devnull if necessary"""
if self.no_stdout or self.no_stderr:
blackhole = file(os.devnull, 'w')
if self.no_stdout:
sys.stdout = sys.__stdout__ = blackhole
if self.no_stderr:
sys.stderr = sys.__stderr__ = blackhole
-
- # Redirect input streams and set a display hook.
-
+
+ def init_io(self):
+ """Redirect input streams and set a display hook."""
if self.outstream_class:
outstream_factory = import_item(str(self.outstream_class))
sys.stdout = outstream_factory(self.session, self.iopub_socket, u'stdout')
@@ -199,6 +198,7 @@ def init_kernel(self):
def initialize(self, argv=None):
super(KernelApp, self).initialize(argv)
+ self.init_blackhole()
self.init_session()
self.init_poller()
self.init_sockets()
Please sign in to comment.
Something went wrong with that request. Please try again.